【问题标题】:How to use K-fold cross validation in TensorFlow如何在 TensorFlow 中使用 K-fold 交叉验证
【发布时间】:2020-12-06 06:17:29
【问题描述】:

enter image description here

我正在使用 TensorFlow 2.3,我想使用 k-folders,有人知道如何使用它吗?

有人知道这是否是训练我的模型的正确方法吗?

如果不是,你能以正确的方式回答我吗?谢谢

【问题讨论】:

  • 我不设置检查点可以吗?

标签: python deep-learning tensorflow2.0


【解决方案1】:

取自blog

from sklearn.model_selection import KFold

kfold = KFold(n_splits=10, shuffle=True)

for train, test in kfold.split(inputs, targets):

  # Define and fit the model
  model = ...
  model.fit(...)

【讨论】:

  • 就是这样。谢谢。
猜你喜欢
  • 2016-10-21
  • 2019-02-19
  • 2011-10-01
  • 2020-10-25
  • 1970-01-01
  • 2018-09-11
  • 1970-01-01
  • 2020-07-30
  • 2015-09-26
相关资源
最近更新 更多