Keras LSTM模型用于序列的二进制分类

ry

我目前正在做一个更大的项目。目标是自动找到时间序列中的分裂点,该分裂点将序列分裂为基本模式。

我以时间序列的形式有很多训练数据,这些数据有不同的长度和分割点,并在有用的位置上手动记录。基本上,我有xyz在长度2,25和50的居中的窗口位置和那些点之间的距离(dist2dist25dist50)。我还划分房间成3D网格并推断出在哪个小区的位置谎言(cell_xcell_ycell_z)。我认为这很有用,因为基本操作很可能在一个或两个单元中。

图。1

图2 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.

coffeinjunky

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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Keras二进制分类-S型激活函数

TensorFlow用于二进制分类

使用Keras对多个独立序列进行二进制分类

使用keras ResNet50模型进行二进制分类的输出层

建立用于LSTM二进制分类的语音数据集

RNN用于序列的二进制分类

二进制Keras LSTM模型不输出二进制预测

Keras-查找二进制分类的召回值

keras中像素级二进制分类的最佳损失函数

Keras多个二进制输出

多标签二进制分类中的Keras class_weight

使用Keras进行二进制分类时,测试损失不会提高

使用交叉验证选择最佳阈值:Keras中的二进制分类

Keras和LSTM中的二进制分类

Keras返回二进制结果

在Keras中定义二进制掩码

keras,scikit-learn,python,二进制分类混淆矩阵(我可能有一个错误)

Keras二进制分类器教程示例仅提供50%的验证准确性

CNN LSTM keras用于视频分类

Keras中二进制分类的输出层

如何在keras模型的熊猫数据框中用二进制矩阵替换float?

Keras LSTM索引顺序(升序或降序),并且在二进制分类中看到字符串附加到1

为什么我在Keras二进制分类模型中获得零精度?

非零二进制精度但Keras分类器中的精度为0

Python,Keras - 二进制文本分类器预测结果是值数组而不是单个概率

二进制输出的模型和分类报告之间的 Keras 准确性不同

使用 keras 更改二进制分类中的损失值和冻结精度值

如何使用 Keras 从二进制图像分类模型中获取类?

Keras 上 LSTM 序列模型的维度问题