BrushEstimator#
- class pybrush.BrushEstimator.BrushEstimator(**kwargs)[source]#
This is the base class for Brush estimators using the c++ engine.
Parameters are defined and documented in
EstimatorInterface
- Attributes:
- best_estimator_pybrush.Program
The final model picked from training. Used in subsequent calls to
predict()
.- archive_list[deap_api.DeapIndividual]
The final population from training.
- data_pybrush.Dataset
The complete data in Brush format.
- train_pybrush.Dataset
Partition of data_ containing `(1-validation_size)`% of the data, in Brush format.
- validation_pybrush.Dataset
Partition of data_ containing `(validation_size)`% of the data, in Brush format.
- search_space_a Brush SearchSpace object.
Holds the operators and terminals and sampling utilities to update programs.
- > NOTE: as for now, when serializing the model with pickle, the objects of type `Dataset` and `SearchSpace` are not serialized.
Methods
fit
(X, y)Fit an estimator to X,y.
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
partial_fit
(X, y[, lock_nodes_depth, ...])Fit an estimator to X,y, without reseting the estimator.
predict
(X)Predict using the best estimator in the archive.
Returns a list of dictionary predictions for all models.
set_params
(**params)Set the parameters of this estimator.
set_partial_fit_request
(*[, ...])Request metadata passed to the
partial_fit
method.- fit(X, y)[source]#
Fit an estimator to X,y.
- Parameters:
- Xnp.ndarray
2-d array of input data.
- ynp.ndarray
1-d array of (boolean) target values.
- get_params(deep=True)[source]#
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.
- partial_fit(X, y, lock_nodes_depth=0, skip_leaves=True)[source]#
Fit an estimator to X,y, without reseting the estimator.
- Parameters:
- Xnp.ndarray
2-d array of input data.
- ynp.ndarray
1-d array of (boolean) target values.
- lock_nodes_depthint, optional
The depth of the tree to lock. Default is 0.
- skip_leavesbool, optional
Whether to skip leaves when locking nodes. Default is True.
- set_partial_fit_request(*, lock_nodes_depth: bool | None | str = '$UNCHANGED$', skip_leaves: bool | None | str = '$UNCHANGED$') BrushEstimator [source]#
Request metadata passed to the
partial_fit
method.Note that this method is only relevant if
enable_metadata_routing=True
(seesklearn.set_config()
). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True
: metadata is requested, and passed topartial_fit
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it topartial_fit
.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.
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:
- lock_nodes_depthstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
lock_nodes_depth
parameter inpartial_fit
.- skip_leavesstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
skip_leaves
parameter inpartial_fit
.
- Returns:
- selfobject
The updated object.