neural_trees.DistilledFIGS#
- class neural_trees.DistilledFIGS(teacher=None, max_rules: int = 256, synthetic: int = 0, random_state: int | None = None)[source]#
Bases:
ClassifierMixin,BaseEstimatorA FIGS model trained on what a strong model learned: fit trains the teacher on (X, y), then a FIGSRegressor with max_rules splits on the teacher’s probability of each class (one regressor for two classes, one per class otherwise). Prediction uses only the FIGS model(s); the teacher is kept to measure agreement.
- Parameters:
- teacherclassifier with predict_proba, default=None
Cloned and fitted on (X, y). None uses scikit-learn’s HistGradientBoostingClassifier(). The measurements in the module docstring used a tuned XGBoost teacher.
- max_rulesint, default=256
Split budget of each FIGS regressor. 256 to 512 is where the gain over FIGS on labels was measured; with several classes the total size is
n_classes * max_rules.- syntheticint, default=0
MUNGE passes over the rows (see neural_trees.distillation.munge), labelled by the teacher for the student. Did not help in the measurements; kept for small tables.
- random_stateint, optional
Seeds FIGS and the synthetic rows.
- Attributes:
- teacher_the fitted teacher
- figs_list of fitted imodels.FIGSRegressor, one per modelled class
- classes_, n_features_in_
- complexity_int, total number of splits over figs_
- set_fit_request(*, sample_weight: bool | None | str = '$UNCHANGED$') DistilledFIGS#
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
sample_weightparameter infit.
- Returns:
- selfobject
The updated object.
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') DistilledFIGS#
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- Parameters:
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
sample_weightparameter inscore.
- Returns:
- selfobject
The updated object.