CrossValidator.kFold constructor

CrossValidator.kFold(
  1. DataFrame samples, {
  2. int numberOfFolds = 5,
  3. DType dtype = dTypeDefaultValue,
})

Creates a k-fold validator to evaluate the quality of a ML model.

It splits a dataset into numberOfFolds test sets and evaluates a model on each produced test set

Parameters:

samples A dataset that is going to be split into numberOfFolds parts to iteratively evaluate on them a model's performance

numberOfFolds A number of parts of the samples

dtype A type for all numerical data

Implementation

factory CrossValidator.kFold(
  DataFrame samples, {
  int numberOfFolds = 5,
  DType dtype = dTypeDefaultValue,
}) {
  initModelSelectionModule();

  final dataSplitterFactory =
      modelSelectionInjector.get<SplitIndicesProviderFactory>();
  final dataSplitter = dataSplitterFactory.createByType(
      SplitIndicesProviderType.kFold,
      numberOfFolds: numberOfFolds);

  return CrossValidatorImpl(
    samples,
    dataSplitter,
    dtype,
  );
}