MOAFeatureImportanceClassifier#
- class capymoa.feature_selection.MOAFeatureImportanceClassifier[source]#
Bases:
FeatureImportanceClassifier,MOAClassifierMOA-backed feature-importance classifier.
Instantiate this class when the underlying learner is a MOA classifier. Pure Python implementations should subclass
FeatureImportanceClassifierinstead.This wrapper is currently restricted to:
HoeffdingTreelearners and subclasses, which are wrapped withFeatureImportanceHoeffdingTreeMOA ensembles built from
HoeffdingTreelearners, which are wrapped withFeatureImportanceHoeffdingTreeEnsemble
If MOA adds other feature-importance learner families in the future, they will not automatically work through this class. In that case this wrapper should be refactored to support those learners explicitly.
Accepted
base_learnerinputs: - CapyMOAMOAClassifierinstance - CapyMOAMOAClassifierclass - raw MOA learner instance - raw MOA learner class- __init__(
- schema: Schema | None = None,
- base_learner: Any = None,
- random_seed: int = 1,
- window_size: int | None = None,
- get_feature_importances(
- normalize: bool = True,
Return the current feature importance scores.
- predict(
- instance: Instance,
Predict the label of an instance.
The base implementation calls
predict_proba()and returns the label with the highest probability.- Parameters:
instance – The instance to predict the label for.
- Returns:
The predicted label or
Noneif the classifier is unable to make a prediction.
- predict_proba(
- instance,
Return probability estimates for each label.
- Parameters:
instance – The instance to estimate the probabilities for.
- Returns:
An array of probabilities for each label or
Noneif the classifier is unable to make a prediction.
- train(instance: Any) None[source]#
Train the classifier with a labeled instance.
- Parameters:
instance – The labeled instance to train the classifier with.
- feature_importances_per_window: list[dict[str, Any]] | None#
- random_seed: int#
The random seed for reproducibility.
When implementing a classifier ensure random number generators are seeded.