LSTM随培训时变化的批量变化
我正在尝试在不同用户的应用程序数据上构建LSTM。我有一个由用户堆叠的应用程序记录组成的大数据框架,因此,例如,前1500行适用于用户1,以下500用于用户2等。每个用户之后重新更新权重的方式,这意味着每次更新后更改批处理大小。为了更好地理解:我希望LSTM首先使用用户1的所有记录,该记录是1500行,并在处理后进行重量更新,此后,它应该占用500行的用户2,并应在此之后更新权重。处理它们等。
我正在与Keras一起建造LSTM。
有可能这样做吗?
谢谢!
I'm trying to build an LSTM on app-log data from different users. I have one big dataframe consisting of stacked app records of the users, so for example the first 1500 rows are for user 1, the following 500 for user 2 etc. I'm now wondering if it is possible to train the LSTM in such a way that the weights are updated after each user which would mean changing the batch size after each update. For a better understanding: I want the LSTM to first take all records of user 1 which are 1500 rows and make an update of weights after processing them, after that it should take the 500 rows of user 2 and should make an update of weights after processing them etc.
I'm building the LSTM with Keras.
Is there a possibility to do so?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你的具体应用场景,但我假设它是时间序列预测。
构建LSTM模型:
您可以使用DataLoader以不同大小的batch size处理来自不同用户的数据,以获得多个用户的数据集。
像这样:
然后,我们开始训练:
很抱歉上面的代码不能直接运行,因为我不知道你的数据情况,所以我只是给你提供一个大概的框架。
I don't know your specific application scenario, but I'm assuming it's time series forecasting.
Build the LSTM model:
You can use DataLoader to process data from different users with batch sizes of different sizes to get data sets of multiple users.
Like this:
Then, we start training:
I'm sorry that the above code is not working directly, because I don't know your data situation, so I just provide you with a general framework.