def make_classifier(estimator, params=None):
"""Make a classifier for a possible regressor.
.. deprecated:: 0.5
Parameters
----------
estimator : sklearn-like class
It must contain at least a fit and predict method.
params : dict, optional
Parameters of the classifier.
Returns
-------
generic_classifier : class
sklearn-like class that is a subclass of estimator. The predict method
has been overwritten in order to return only the sign of the results.
Note: this assumes that labels are 1 and -1.
"""
if params is None:
params = {}
params['predict'] = predict
params.setdefault('score', accuracy_score)
return type('GenericClassifier', (estimator,), params)()
评论列表
文章目录