pythonscikit-learnpytorchk-fold

evaluation about K-fold cross validation


After K-fold cross validation, which evaluation metric was averaged? Precision and recall, or F-measure?

import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
KFold(n_splits=2, random_state=None, shuffle=False)

Solution

  • The sklearn.model_selection.KFold function is a utility that provides the folds but does not actually perform k-fold validation. You have to implement this yourself!

    See documentation description:

    Provides train/test indices to split data in train/test sets. Split dataset into k consecutive folds (without shuffling by default).

    Each fold is then used once as a validation while the k - 1 remaining folds form the training set.