Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the What you really need to know section for the big picture.
julearn.models.dynamic.DynamicSelection#
- class julearn.models.dynamic.DynamicSelection(ensemble, algorithm, ds_split=0.2, random_state=None, random_state_algorithm=None, **kwargs)#
- Model to use dynamic selection algorithms from DESlib. - Parameters:
- ensembleModelLike
- sklearn compatible ensemble model. E.g RandomForest 
- algorithmstr
- algorithm from deslib to make the model dynamic. Options: - METADES 
- SingleBest 
- StaticSelection 
- StackedClassifier 
- KNORAU 
- KNORAE 
- DESP 
- OLA 
- MCB 
- KNOP 
 
- ds_splitfloat, optional
- How to split the training data. One split is used to train the ensemble model and the other to train the dynamic algorithm, by default .2 You can use any sklearn cv consistent cv splitter, but only with n_splits = 1. 
- random_stateint, optional
- random state to get reproducible train test splits in case you use a float for ds_split (default is None). 
- random_state_algorithmint, optional
- random state to get reproducible Deslib algorithm models (default is None). 
- **kwargsAny
- Any additional parameters to pass to the deslib algorithm. 
 
 - __init__(ensemble, algorithm, ds_split=0.2, random_state=None, random_state_algorithm=None, **kwargs)#
 - fit(X, y)#
- Fit the model. - Parameters:
- XDataLike
- The data to fit the model on. 
- yDataLike
- The target data. 
 
- Returns:
- DynamicSelection
- The fitted model. 
 
 
 - predict(X)#
- Predict using the model. - Parameters:
- XDataLike
- The data to predict on. 
 
- Returns:
- DataLike
- The predictions. 
 
 
 - predict_proba(X)#
- Compute probabilities of possible outcomes for samples in X. - Parameters:
- XDataLike
- The data to predict on. 
 
- Returns:
- np.ndarray
- Returns the probability of the sample for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute classes_. 
 
 
 - score(X, y, sample_weight=None)#
- Score the model. - Parameters:
- Xpd.DataFrame
- The data to predict on. 
- yDataLike
- The true target values. 
- sample_weightDataLike, optional
- Sample weights to use when computing the score (default None). 
 
- Returns:
- float
- The score. 
 
 
 - get_metadata_routing()#
- Get metadata routing of this object. - Please check User Guide on how the routing mechanism works. - Returns:
- routingMetadataRequest
- A - MetadataRequestencapsulating routing information.
 
 
 - get_params(deep=True)#
- Get parameters for this estimator. - Parameters:
- deepbool, default=True
- If True, will return the parameters for this estimator and contained subobjects that are estimators. 
 
- Returns:
- paramsdict
- Parameter names mapped to their values. 
 
 
 - set_params(**params)#
- Set the parameters of this estimator. - The method works on simple estimators as well as on nested objects (such as - Pipeline). The latter have parameters of the form- <component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
- Estimator parameters. 
 
- Returns:
- selfestimator instance
- Estimator instance. 
 
 
 - set_score_request(*, sample_weight='$UNCHANGED$')#
- Request metadata passed to the - scoremethod.- Note that this method is only relevant if - enable_metadata_routing=True(see- sklearn.set_config()). Please see User Guide on how the routing mechanism works.- The options for each parameter are: - True: metadata is requested, and passed to- scoreif provided. The request is ignored if metadata is not provided.
- False: metadata is not requested and the meta-estimator will not pass it to- score.
- 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.- New in version 1.3. - Note - This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a - Pipeline. Otherwise it has no effect.- Parameters:
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
- Metadata routing for - sample_weightparameter in- score.
 
- Returns:
- selfobject
- The updated object.