Every sklearn estimator provides the get_params(deep=True) and set_params(params) methods. These are used e.g. when cloning an estimator. The parameters of an estimator are the arguments of its __init__ method and, as of sklearn's convention, these are all set as class attributes (see BaseEstimator._get_param_names()). When an argument of __init__ is not set as a class attribute, as is the case with ActiveLearner.bootstrap_init, BaseEstimator.get_params() prints a warning. As of version 0.24 of sklearn, an error will be thrown.
This is a minimalistic code snippet which should reproduce the issue.
from modAL.models import ActiveLearner
from modAL.uncertainty import uncertainty_sampling
from sklearn.ensemble import RandomForestClassifier
learner = ActiveLearner(
estimator=RandomForestClassifier(),
query_strategy=uncertainty_sampling
)
learner.set_params(learner.get_params(deep=True))
A simple solution would be to save all arguments of the __init__ method as class attributes.
Every sklearn estimator provides the
get_params(deep=True)
andset_params(params)
methods. These are used e.g. when cloning an estimator. The parameters of an estimator are the arguments of its__init__
method and, as of sklearn's convention, these are all set as class attributes (seeBaseEstimator._get_param_names()
). When an argument of__init__
is not set as a class attribute, as is the case withActiveLearner.bootstrap_init
,BaseEstimator.get_params()
prints a warning. As of version 0.24 of sklearn, an error will be thrown.This is a minimalistic code snippet which should reproduce the issue.
A simple solution would be to save all arguments of the
__init__
method as class attributes.