7. Collectors & Extractors¶
7.1. miplearn.classifiers.minprob¶
-
class
miplearn.classifiers.minprob.
MinProbabilityClassifier
(base_clf: Any, thresholds: List[float], clone_fn: Callable[[Any], Any] = <function clone>)¶ Bases:
sklearn.base.BaseEstimator
Meta-classifier that returns NaN for predictions made by a base classifier that have probability below a given threshold. More specifically, this meta-classifier calls base_clf.predict_proba and compares the result against the provided thresholds. If the probability for one of the classes is above its threshold, the meta-classifier returns that prediction. Otherwise, it returns NaN.
-
fit
(x: numpy.ndarray, y: numpy.ndarray) → None¶
-
predict
(x: numpy.ndarray) → numpy.ndarray¶
-
7.2. miplearn.classifiers.singleclass¶
-
class
miplearn.classifiers.singleclass.
SingleClassFix
(base_clf: sklearn.base.BaseEstimator, clone_fn: Callable = <function clone>)¶ Bases:
sklearn.base.BaseEstimator
Some sklearn classifiers, such as logistic regression, have issues with datasets that contain a single class. This meta-classifier fixes the issue. If the training data contains a single class, this meta-classifier always returns that class as a prediction. Otherwise, it fits the provided base classifier, and returns its predictions instead.
-
fit
(x: numpy.ndarray, y: numpy.ndarray) → None¶
-
predict
(x: numpy.ndarray) → numpy.ndarray¶
-