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!
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.