Dela via


RankingCatalog.CrossValidate Method

Definition

Run cross-validation over numberOfFolds folds of data, by fitting estimator, and respecting rowGroupColumnNameif provided. Then evaluate each sub-model against labelColumnName and return metrics.

public System.Collections.Generic.IReadOnlyList<Microsoft.ML.TrainCatalogBase.CrossValidationResult<Microsoft.ML.Data.RankingMetrics>> CrossValidate (Microsoft.ML.IDataView data, Microsoft.ML.IEstimator<Microsoft.ML.ITransformer> estimator, int numberOfFolds = 5, string labelColumnName = "Label", string rowGroupColumnName = "GroupId", int? seed = default);
member this.CrossValidate : Microsoft.ML.IDataView * Microsoft.ML.IEstimator<Microsoft.ML.ITransformer> * int * string * string * Nullable<int> -> System.Collections.Generic.IReadOnlyList<Microsoft.ML.TrainCatalogBase.CrossValidationResult<Microsoft.ML.Data.RankingMetrics>>
Public Function CrossValidate (data As IDataView, estimator As IEstimator(Of ITransformer), Optional numberOfFolds As Integer = 5, Optional labelColumnName As String = "Label", Optional rowGroupColumnName As String = "GroupId", Optional seed As Nullable(Of Integer) = Nothing) As IReadOnlyList(Of TrainCatalogBase.CrossValidationResult(Of RankingMetrics))

Parameters

data
IDataView

The data to run cross-validation on.

estimator
IEstimator<ITransformer>

The estimator to fit.

numberOfFolds
Int32

Number of cross-validation folds.

labelColumnName
String

The label column (for evaluation).

rowGroupColumnName
String

The name of the groupId column in data, which is used to group rows. This column will automatically be used as SamplingKeyColumn when splitting the data for Cross Validation, as this is required by the ranking algorithms If null no row grouping will be performed.

seed
Nullable<Int32>

Seed for the random number generator used to select rows for cross-validation folds.

Returns

Per-fold results: metrics, models, scored datasets.

Applies to