> ## Documentation Index
> Fetch the complete documentation index at: https://systematica.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Meta Model

> systematica.api.analytics.meta_model

## `MetaModelCV`

```python theme={null}
MetaModelCV(
    id: str = None,
    loader_or_data: Callable = <function load_clean_data>,
    timeframe: str = '1d',
    start: str = None,
    end: str = None,
    s1: str = 'BTCUSDT',
    s2: str = 'ETHUSDT',
    suffix: str = 'h5',
    use_close: bool = True,
    freq: str = None,
    signal_model: str = None,
    long_entries: float = nan,
    long_exits: float = nan,
    short_entries: float = nan,
    short_exits: float = nan,
    clean: bool = True,
    select_symbols: str | int | List[str | int] = None,
    portfolio_config: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
    metrics: str | List[str] = None,
    metrics_kwargs: Dict[str, Any] = _Nothing.NOTHING,
    use_rolling: bool = False,
    storage: str | optuna.storages._base.BaseStorage = None,
    pruner: optuna.pruners._base.BasePruner = <optuna.pruners._successive_halving.SuccessiveHalvingPruner object>,
    sampler: optuna.samplers._base.BaseSampler = <optuna.samplers._tpe.sampler.TPESampler object>,
    study_name: str = None,
    direction: str | List[str] = 'maximize',
    load_if_exists: bool = False,
    n_trials: int = 100,
    n_completed_trials: int = None,
    timeout: float = None,
    n_jobs: int = 1,
    catch: Iterable[Type[Exception]] | Type[Exception] = _Nothing.NOTHING,
    callbacks: Iterable[Callable[[optuna.study.study.Study, optuna.trial._frozen.FrozenTrial], None]] | None = None,
    gc_after_trial: bool = False,
    show_progress_bar: bool = False,
    verbose: bool = True,
    tracker: Type = None,
    model: Any = None,
    preprocess_func: Callable = None,
)
```

Breakdown analysis for meta model, extending `BaseModelBreakdownCV`.

Method generated by attrs for class WalkForwardCV.

### Ancestors

* `systematica.walk_forward.cv.WalkForwardCV`
* `systematica.walk_forward.base.BaseWalkForward`
* `abc.ABC`
* `systematica.generic.base.Model`
* `systematica.generic.base.Feature`

### Methods

#### `score`

```python theme={null}
score(
    self,
    estimator: sklearn.base.BaseEstimator,
    X: pandas.core.frame.DataFrame | numpy.ndarray,
    y: numpy.ndarray | pandas.core.series.Series,
    scoring: str = 'accuracy',
    n_jobs: int = None,
    verbose: int = 0,
) ‑> pandas.core.series.Series
```

Evaluate a score by cross-validation.

This method uses scikit-learn's `cross_val_score` to evaluate the
performance of an estimator on a given dataset using cross-validation.

**See Also**:

* `cross_validate`: To run cross-validation on multiple metrics and also to
  return train scores, fit times and score times.
* `cross_val_predict`: Get predictions from each split of cross-validation for
  diagnostic purposes.
* `sklearn.metrics.make_scorer`: Make a scorer from a performance metric or
  loss function.

**Parameters**:

| Name        | Type            | Default    | Description                                                                                                                                                                                                                                            |
| ----------- | --------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `estimator` | `BaseEstimator` | `--`       | The object to use to fit the data.                                                                                                                                                                                                                     |
| `X`         | `pd.DataFrame`  | `--`       | The data to fit.                                                                                                                                                                                                                                       |
| `y`         | `pd.Series`     | `--`       | The target variable.                                                                                                                                                                                                                                   |
| `scoring`   | `str`           | `accuracy` | The scoring method to use for evaluation. It can be one of the predefined strings in scikit-learn, such as 'accuracy', 'f1', 'roc\_auc', etc., or a custom scoring function that follows the scikit-learn scorer interface. Defaults to `accuracy`.    |
| `n_jobs`    | `int`           | `None`     | Number of jobs to run in parallel. Training the estimator and computing the score are parallelized over the cross-validation splits. `None` means 1 unless in a `joblib.parallel_backend` context. `-1` means using all processors. Default is `None`. |
| `verbose`   | `int`           | `0`        | Verbosity level. Controls the verbosity of the output during cross-validation. `0` means no output, `1` means progress messages, and higher values increase verbosity. Default is `0`.                                                                 |

**Returns**:

| Type        | Description                                                   |
| ----------- | ------------------------------------------------------------- |
| `pd.Series` | Scores of the estimator for each run of the cross validation. |

## `MetaModelRolling`

```python theme={null}
MetaModelRolling(
    id: str = None,
    loader_or_data: Callable = <function load_clean_data>,
    timeframe: str = '1d',
    start: str = None,
    end: str = None,
    s1: str = 'BTCUSDT',
    s2: str = 'ETHUSDT',
    suffix: str = 'h5',
    use_close: bool = True,
    freq: str = None,
    signal_model: str = None,
    long_entries: float = nan,
    long_exits: float = nan,
    short_entries: float = nan,
    short_exits: float = nan,
    clean: bool = True,
    select_symbols: str | int | List[str | int] = None,
    portfolio_config: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
    metrics: str | List[str] = None,
    metrics_kwargs: Dict[str, Any] = _Nothing.NOTHING,
    use_rolling: bool = False,
    storage: str | optuna.storages._base.BaseStorage = None,
    pruner: optuna.pruners._base.BasePruner = <optuna.pruners._successive_halving.SuccessiveHalvingPruner object>,
    sampler: optuna.samplers._base.BaseSampler = <optuna.samplers._tpe.sampler.TPESampler object>,
    study_name: str = None,
    direction: str | List[str] = 'maximize',
    load_if_exists: bool = False,
    n_trials: int = 100,
    n_completed_trials: int = None,
    timeout: float = None,
    n_jobs: int = 1,
    catch: Iterable[Type[Exception]] | Type[Exception] = _Nothing.NOTHING,
    callbacks: Iterable[Callable[[optuna.study.study.Study, optuna.trial._frozen.FrozenTrial], None]] | None = None,
    gc_after_trial: bool = False,
    show_progress_bar: bool = False,
    verbose: bool = True,
    tracker: Type = None,
    model: Any = None,
    preprocess_func: Callable = None,
)
```

Breakdown analysis for meta model, extending `BaseWalkForward`.

Method generated by attrs for class RollingWalkForward.

### Ancestors

* `systematica.walk_forward.rolling.RollingWalkForward`
* `systematica.walk_forward.base.BaseWalkForward`
* `abc.ABC`
* `systematica.generic.base.Model`
* `systematica.generic.base.Feature`
