Skip to main content

BaseMetaModel

A model class for feature processing and category management. This class provides utilities to work with feature data, extract categories, and generate visualizations for model analysis. Method generated by attrs for class BaseMetaModel.

Static methods

set_keys

Set keys. Parameters: Returns:

from_model_config

Create a Model instance from rolling metrics. Parameters: Returns:

from_neptune_config

Create a Model instance from rolling metrics. Parameters: Returns:

Instance variables

  • add_features: Dict[str, Callable]:
  • categories: pandas.core.series.Series:
  • category_mapping: Dict[str, int]:
  • data: vectorbtpro.data.base.Data:
  • features: pandas.core.frame.DataFrame | numpy.ndarray:
  • label_mapping: Dict[str, int]:
  • minp: int:
  • model_mapping: Dict[str, systematica.portfolio.analyzer.PortfolioAnalyzer]:
  • runners: Dict[str, vectorbtpro.portfolio.base.Portfolio]:
  • s1: str:
  • s2: str:
  • window_in_days: int:

Methods

run_clf

Meta classifier CV. Parameters: Returns:

get_target

Convert categorical labels to numeric codes. Parameters: Returns:

get_inputs

Get state representation: Input (X).
To include data in vbt.Data object, use data.add_feature method as follow:
Parameters: Returns:

get_accuracy_score

Get Accuracy classification score. In multilabel classification, this function computes subset accuracy: the set of labels predicted for a sample must exactly match the corresponding set of labels in y_true. See Also:
  • balanced_accuracy_score: Compute the balanced accuracy to deal with imbalanced datasets.
  • jaccard_score: Compute the Jaccard similarity coefficient score.
  • hamming_loss: Compute the average Hamming loss or Hamming distance between two sets of samples.
  • zero_one_loss : Compute the Zero-one classification loss. By default, the function will return the percentage of imperfectly predicted subsets.
Parameters: Returns:

get_report

Build a report showing the main classification metrics. See Also:
  • precision_recall_fscore_support: Compute precision, recall, F-measure and support for each class.
  • confusion_matrix: Compute confusion matrix to evaluate the accuracy of a classification.
  • multilabel_confusion_matrix: Compute a confusion matrix for each class or sample.
Parameters: Returns:

get_confusion_matrix

Compute confusion matrix to evaluate the accuracy of a classification. By definition a confusion matrix CC is such that Ci,jC_{i, j} is equal to the number of observations known to be in group :math: ii and predicted to be in group jj. Thus in binary classification, the count of true negatives is C0,0C_{0,0}, false negatives is C1,0C_{1,0}, true positives is C1,1C_{1,1} and false positives is C0,1C_{0,1}. See Also:
  • ConfusionMatrixDisplay.from_estimator: Plot the confusion matrix given an estimator, the data, and the label.
  • ConfusionMatrixDisplay.from_predictions: Plot the confusion matrix given the true and predicted labels.
  • ConfusionMatrixDisplay : Confusion Matrix visualization.
Parameters: Returns:

get_feature_importance

The impurity-based feature importances. The higher, the more important the feature. The importance of a feature is computed as the (normalized) total reduction of the criterion brought by that feature. It is also known as the Gini importance.
Impurity-based feature importances can be misleading for high cardinality features (many unique values). See sklearn.inspection.permutation_importance as an alternative.
Parameters: Returns:

plot_rolling_metrics

Visualize rolling metrics from features. Returns:

plot_target

Visualize encoded labels. Returns:

plot_heatmap_overlay

Plot a Series as a line and overlay it with a heatmap. Parameters: Returns: