BPt.Model#

class BPt.Model(obj, params=0, scope='all', param_search=None, target_scaler=None, cache_loc=None, **extra_params)[source]#

The Model class represents a base component of the Pipeline / ModelPipeline. This component is namely the estimator responsible for making predictions or classifications.

objstr or custom_obj
The passed object should be either a preset str indicator found at Models, or from a custom passed user model (compatible w/ sklearn api).

Note

The passed parameter should be either a single str or a custom object, not a list-like of either. In the case that an ensemble of Model is needed, see Ensemble.

See Pipeline Objects to read more about pipeline objects in general.
paramsint, str or dict of params, optional
The parameter params can be used to set an associated distribution of hyper-parameters, fixed parameters or combination of.
Preset parameter options can be found distributions are listed for each choice of params with the corresponding obj at Pipeline Options.
More information on how this parameter works can be found at Params.
default = 0
scopeScope, optional
The scope parameter determines the subset of features / columns in which this object should operate on within the created pipeline. For example, by specifying scope = ‘float’, then this object will only operate on columns with scope float.
See Scope for more information on how scopes can be specified.
default = 'all'
param_searchParamSearch, None, optional
This parameter optionally specifies that this object should be nested with a hyper-parameter search.
If passed an instance of ParamSearch, the underlying object, or components of the underlying object (if a pipeline) must have atleast one valid hyper-parameter distribution to search over.
If left as None, the default, then no hyper-parameter search will be performed.
default = None
target_scalerScaler, None, optional
Can optionally pass an instance of Scaler here to have properly nested target scaling / reverse scaling (before scoring) applied.

Warning

This parameter is still experimental. It has not been fully tested in complicated nesting cases, e.g., if Model is wrapping a nested Pipeline, this param will likely break.

default = None
cache_locstr, Path or None, optional
This parameter can optionally be set to a str or path representing the location in which this object will be cached after fitting. To skip this option, keep as the default argument of None.
If set, the python library joblib is used to cache a copy after fitting and in the case that a cached copy already exists will load from that copy instead of re-fitting the base object.
default = None
extra_paramsExtra Params
You may pass additional kwargs style arguments for this piece as Extra Params. Any values passed here will be used to try and set that value in the requested obj.
Any parameter value pairs specified here will take priority over any set via params. For example, lets say in the object we are initializing, ‘fake obj’ it has a parameter called size, and we want it fixed as 10, we can specify that with:
(obj='fake obj', ..., size=10)

See Extra Params for more information.

See also

Ensemble

For an ensemble of Models.

Methods

build([dataset, problem_spec])

This method is used to convert a single pipeline piece into the base sklearn style object used in the pipeline.

copy()

This method returns a deepcopy of the base object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.