Documentation
¶
Overview ¶
Package crossval provides cross-validation utilities for model evaluation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KFold ¶
type KFold struct {
// NSplits is the number of folds (K)
NSplits int
// Shuffle whether to shuffle the data before splitting
Shuffle bool
// Seed for random number generator (used if Shuffle is true)
Seed int64
}
KFold provides K-fold cross-validation splitting. Splits dataset into K consecutive folds. Each fold is used once as validation while the remaining K-1 folds form the training set.
type Scorer ¶
type Scorer interface {
Fit(X *dataframe.DataFrame, y *seriesPkg.Series[any]) error
Predict(X *dataframe.DataFrame) (*seriesPkg.Series[any], error)
}
CrossValScore performs cross-validation and returns scores for each fold.
type StratifiedKFold ¶
type StratifiedKFold struct {
// NSplits is the number of folds
NSplits int
// Shuffle whether to shuffle within each class before splitting
Shuffle bool
// Seed for random number generator
Seed int64
}
StratifiedKFold provides stratified K-fold cross-validation. Stratification ensures that each fold maintains the same class distribution as the complete dataset. Important for imbalanced datasets.
func NewStratifiedKFold ¶
func NewStratifiedKFold(nSplits int, shuffle bool, seed int64) *StratifiedKFold
NewStratifiedKFold creates a new stratified K-fold cross-validator.
Click to show internal directories.
Click to hide internal directories.