【问题标题】:shuffle in the model.fit of keras在 keras 的 model.fit 中随机播放
【发布时间】:2018-10-15 11:39:02
【问题描述】:

kerasmodel.fit中,有一个shuffle参数,

shuffle: Boolean (whether to shuffle the training data before each epoch) or str (for 'batch'). '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.

假设训练集是一个带有50000元素的列表,那么整个列表会在每个epoch之前随机排列吗?如果批量大小是250,只有属于每个批次的元素会被置换?正确的理解应该是什么?

【问题讨论】:

    标签: tensorflow deep-learning keras


    【解决方案1】:

    根据您传递给fitbatch_size 参数,它将先shuffle your entire dataset (x, y and sample_weight together) first 然后make batches

    编辑

    正如@yuk 在评论中指出的那样,代码自 2018 年以来发生了重大变化。shuffle 参数的文档现在似乎更清楚了。您可以选择打乱整个训练数据或只是打乱批次:

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

    【讨论】:

    猜你喜欢
    • 2023-01-23
    • 1970-01-01
    • 1970-01-01
    • 2014-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多