Search code examples
tensorflowkerastime-serieslstmbatchsize

What is the difference between "batch size in tf.keras.preprocessing.timeseries_dataset_from_array" and "batch size in model.fit"?


As you can see from this tutorial (https://www.tensorflow.org/tutorials/structured_data/time_series) I'm working on prediction of time series.

I would like to ask the differences between batch size in tf.keras.preprocessing.timeseries_dataset_from_array as in Section 4 in the tutorial and batch size in model.fit. If these two arguments are the same, then what happens if I also write batch size in model.fit ?

Thank you.


Solution

  • From the documentation on model.fit located here.

    batch_size: Integer or None. A number of samples per gradient update. If unspecified, 
    batch_size will default to 32. 
    Do not specify the batch_size if your data is in the form of datasets, generators,
    or keras. utils.Sequence instances (since they generate batches).
    

    So do not specify the batch size in model.fit