shuffle in the model.fit of keras

前端 未结 1 548
夕颜
夕颜 2021-02-07 02:21

In the model.fit of keras, there is a shuffle parameter,

shuffle: Boolean (whether to shuffle the training data before eac         


        
1条回答
  •  无人共我
    2021-02-07 03:02

    It will shuffle your entire dataset (x, y and sample_weight together) first and then make batches according to the batch_size argument you passed to fit.

    Edit

    As @yuk pointed out in the comment, the code has been changed significantly since 2018. The documentation for the shuffle parameter now seems more clear on its own. You can choose to shuffle the entire training data or just shuffle the batch:

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

    0 讨论(0)
提交回复
热议问题