Skip to main content

MetaModelCV

MetaModelCV(
    idstr = 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

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:
NameTypeDefaultDescription
estimatorBaseEstimator--The object to use to fit the data.
Xpd.DataFrame--The data to fit.
ypd.Series--The target variable.
scoringstraccuracyThe 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_jobsintNoneNumber 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.
verboseint0Verbosity 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:
TypeDescription
pd.SeriesScores of the estimator for each run of the cross validation.

MetaModelRolling

MetaModelRolling(
    idstr = 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