When I fit my LSTM model in Keras using the generator above, like this: history = _generator(self.generator(), Yield (np.array(the_batch), np.array(the_batch)) # convert the 3d list to 3D numpy array to feed into LSTM The_batch.append(np.array(df)) #appends new sample data to batch list Here is my generator: def generator(self):įilename = self.files #select file with index 'counter'Ĭounter = (counter + 1) % len(self.files) #Ensures that each batch is divided (e.g 1 % 32 = 1, 2 % 32 = 2 etc)ĭf = pd.read_csv(self.data_path + "/" + filename, header=None) #Reads data for one sample I am generating a dataset in batches to feed into an LSTM network in Keras.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |