Skip to content

cross_validate

Module: strata.model_selection • Kind: function
Source: strata/model_selection/validation.mojo

def cross_validate[
ModelType: Regressor,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.float64,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
scoring: List[String],
cv: Int = 5,
return_train_score: Bool = False,
) -> CrossValidateResult
def cross_validate[
ModelType: Regressor,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.float64,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
splits: List[Split],
scoring: List[String],
return_train_score: Bool = False,
) -> CrossValidateResult
def cross_validate[
ModelType: Classifier,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.int32,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
scoring: List[String],
cv: Int = 5,
return_train_score: Bool = False,
) -> CrossValidateResult
def cross_validate[
ModelType: Classifier,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.int32,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
splits: List[Split],
scoring: List[String],
return_train_score: Bool = False,
) -> CrossValidateResult

Overload Note: This function provides multiple overloaded signatures.

from strata.model_selection import cross_validate

Evaluates several regression metrics across K folds in one pass.

Returns: CrossValidateResult — Per-fold scores for every requested metric.