我目前正在做一个更大的项目。目标是自动找到时间序列中的分裂点,该分裂点将序列分裂为基本模式。
我以时间序列的形式有很多训练数据,这些数据有不同的长度和分割点,并在有用的位置上手动记录。基本上,我有x
,y
,z
在长度2,25和50的居中的窗口位置和那些点之间的距离(dist2
,dist25
,dist50
)。我还划分房间成3D网格并推断出在哪个小区的位置谎言(cell_x
,cell_y
,cell_z
)。我认为这很有用,因为基本操作很可能在一个或两个单元中。
cell_x,cell_y,cell_z基于大小50。垂直红线是训练数据的分割点。
现在,我想知道时间序列中的每个点是否为分裂点。
In my opinion, these are enough features to start with but I think my Keras model isn't correct because the result is always and only 1 at the 0's time series index. It's basically, a binary classification problem based on past and future values. This was the reason I've tried to solve it with an LSTM. It looks like this:
model = Sequential()
model.add(LSTM(20, input_shape = (None, input_dim), return_sequences = True))
model.add(Dropout(0.5))
model.add(LSTM(20))
model.add(Dropout(0.5))
model.add(Dense(1, activation = 'sigmoid'))
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
Because I'm at the very beginning of the whole Machine Learning topic and the mass of materials is a bit overwhelming I'm here to ask for some help. I know that there are a lot of other things (bad training data, wrong features, wrong parameters, ...) which can cause to this results but I want to know how I can build a Keras model for this problem correctly. I already found a lot of Keras examples but I'm not sure if they fit the problem.
This is way too long for a comment, so I post it as an answer:
First, in principle, you can feed your data into Keras
's LSTM and hope that the network learns how to spot what you call a split point. With enough (labelled) data, this seems like an interesting project, even though imbalanced classes may be a problem (which can surely be addressed using either weights, resampling techniques or some similar)! I believe all this has been said in the various comments already. If you don't really care about the time-dimension, you may also want to try to see how other network architectures perform.
On a more general level, I wonder though if a sequential neural network is the right approach for this. There are many tried and tested approaches in time series econometrics and related fields. They come under various names, from structural break, change point or parameter stability detection. If you want to decide if new data points belong to a different regime, then there might be some techniques in anomaly/outlier detection you may find useful. To find a suitable statistical test (which are meant to find the time index when a break occurrs) that is appropriate for your particular setting, you will probably have to dig a little bit into the actual literature as only few of these are readily available in open source packages (i.e. "few" as a fraction of everything that is out there). I know that there are a few options availabe in R packages (click, click), and I am sure something similar exists in Python, though I am not very familiar with the statistics-packages in Python, so I can't link to any even though they surely exist.
如果您正在寻找一种易于访问的高级开放源代码解决方案,则有些人会发现facebook的先知很有趣,这使您可以对时间序列进行建模,并且可以自动检测变化点。我不确定标记的分割点可以在多大程度上进入模型以帮助学习这些点,但是一个很好的起点可能是查看自动检测到的点是否与标记的点相似。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句