seqme.metrics.Fold#
- class seqme.metrics.Fold(metric, *, deviation='std', estimate='unbiased', n_splits=None, split_size=None, drop_last=False, strict=True, shuffle=False, seed=0)[source]#
A wrapper for any metric, which splits the sequences into non-overlapping subsets, computes the metric on each split and aggregates the results.
Fold splits the data into k-folds or fixed-size splits, with optional shuffling, and then aggregates the results.
- __init__(metric, *, deviation='std', estimate='unbiased', n_splits=None, split_size=None, drop_last=False, strict=True, shuffle=False, seed=0)[source]#
Initialize the Fold wrapper.
- Parameters:
metric (
Metric) – The underlying metric to evaluate per fold.deviation (
Literal['std','se','var']) –Type of deviation to compute:
'std': Standard deviation'se': Standard error'var': Variance
estimate (
Literal['biased','unbiased']) – How to estimate the deviation.n_splits (
Optional[int]) – Number of folds to create (exclusive withsplit_size).split_size (
Optional[int]) – Fixed size for each fold (exclusive withn_splits).drop_last (
bool) – Drop final fold if smaller thansplit_size.strict (
bool) – Error on any non-null fold deviation.shuffle (
bool) – Shuffle data before splitting.seed (
int) – Seed for deterministic shuffling of sequences when creating folds.
- __call__(sequences)[source]#
Call the wrapped metric on each fold of
sequencesand aggregate the results.- Parameters:
- Returns:
Aggregated mean value and standard deviation, standard error or variance across folds.
- Return type:
Methods
Attributes
|
Name of the metric. |
|
Whether lower or higher scores indicate better performance. |