CMZ
CMZ

Reputation: 21

How to use K-fold cross validation in TensorFlow

enter image description here

I'm using TensorFlow 2.3 and i want to use k-folders, does anyone know how to use it?

Does anybody know if that's the right way to train my model?

if not, can you answer me the right way. Thanks

Upvotes: 0

Views: 1065

Answers (1)

Kenan
Kenan

Reputation: 14124

Taken from this 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(...)

Upvotes: 1

Related Questions