Skip to content

cross_val_score

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

def cross_val_score[
ModelType: Regressor,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.float64,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
cv: Int = 5,
scoring: String = "r2",
) -> List[Float64]
def cross_val_score[
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: String = "r2",
) -> List[Float64]
def cross_val_score[
ModelType: Classifier,
feat_dtype: DType = DType.float64,
target_dtype: DType = DType.int32,
](
estimator: ModelType,
X: Matrix[feat_dtype],
y: List[Scalar[target_dtype]],
cv: Int = 5,
scoring: String = "accuracy",
) -> List[Float64]
def cross_val_score[
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: String = "accuracy",
) -> List[Float64]

Overload Note: This function provides multiple overloaded signatures.

from strata.model_selection import cross_val_score

Evaluate regression scores by cross-validation across K folds.

Returns: List[Float64] — List[Float64]: Array of evaluation metric scores for each run fold.