# Will Keras fit( ) function automatically shuffles the input dataset by default?

I am asking this model fit( ) function.

fit(x=array_x, y=array_y, batch_size=32, epochs=10)


The question is straightforward:

Whether fit( ) will automatically shuffle the input dataset? (array_x, array_y in this case)

I ask this question because I find my fit( ) and fit_generator( ) has different outputs, with same input. My generator feeds inputs to fit_generator( ) in order. I guess the reason is about shuffle.

Yes, by default it does shuffle.

Here is the documentation.

The default call signature:

fit(x=None, y=None, batch_size=None, epochs=1, verbose=1, callbacks=None,
validation_split=0.0, validation_data=None, shuffle=True,
lass_weight=None, sample_weight=None, initial_epoch=0,
steps_per_epoch=None, validation_steps=None, validation_freq=1,
ax_queue_size=10, workers=1, use_multiprocessing=False)


where the description for shuffle is:

shuffle: Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). This argument is ignored when x is a generator. 'batch' is a special option for dealing with the limitations of HDF5 data; it shuffles in batch-sized chunks. Has no effect when steps_per_epoch is not None.

This means it will not shuffle if you have set a value for steps_per_epoch.