简体   繁体   English

如何获得时间序列LSTM keras模型的“平均值”?

[英]How to get the “average” of a time series LSTM keras model?

So just an FYI, I have a pretty limited understanding of the mechanics of machine learning, LSTM, and time series modeling, but based on my current understanding, I feel like since I have a LSTM time series model trained on many time series plots, I should be able to get its "average" time series based on all of the ones it's trained on. 因此,仅就FYI而言,我对机器学习,LSTM和时间序列建模的机制知之甚少,但是基于我目前的理解,我感觉自从我有了在许多时间序列图上训练的LSTM时间序列模型后,我应该能够基于所有受训练的时间序列来获得其“平均”时间序列。

What's the best way to accomplish that? 做到这一点的最佳方法是什么?

I have a keras Sequential model, and I don't know if any code would even be helpful in this instance, but if there is any code that would assist, let me know! 我有一个keras顺序模型,我不知道在这种情况下是否有任何代码甚至会有所帮助,但是如果有任何代码可以帮助您,请告诉我!

EDIT: Here is some of the data 编辑:这是一些数据

32.1576
31.92
31.7
31.85
32.05
32.5
32.3
31.975
31.7
32.15
32.6
32.55
32.4
32.4835
32.25
32.15
32.25
32.45
32.4
32.5002
32.45
32.5
32.5752
33.1748
33
33.35
33.45
33.45
33.425

Thanks! 谢谢!

You can use keras.layers.GlobalAveragePooling1D in order to average the time series. 您可以使用keras.layers.GlobalAveragePooling1D来平均时间序列。 If the input shape is (batch_size, steps, features) , the output shape is (batch_size, features) . 如果输入形状为(batch_size, steps, features) ,则输出形状为(batch_size, features) Weather or not you are using a Sequential model doesn't matter in this case. 在这种情况下,无论您是否使用天气,都可以使用顺序模型。 This layer works juts like any other layer in Keras. 该层的功能类似于Keras中的其他任何层。 More information here: https://keras.io/layers/pooling/#globalaveragepooling1d 此处的更多信息: https : //keras.io/layers/pooling/#globalaveragepooling1d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM