gpt4 book ai didi

tensorflow - 在 keras 的 model.fit 中洗牌

转载 作者:行者123 更新时间:2023-12-04 01:36:00 29 4
gpt4 key购买 nike

model.fitkeras ,有一个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 的列表元素,所以整个列表将在每个纪元之前随机排列?如果批量大小为 250 ,只有属于每个批次的元素才会被置换?正确的理解应该是什么?

最佳答案

它将 shuffle your entire dataset ( x , y and sample_weight together) first然后 make batches根据 batch_size您传递给 fit 的参数.
编辑
正如@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`.

关于tensorflow - 在 keras 的 model.fit 中洗牌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50184144/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com