10. Collectors & Extractors¶
10.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¶
-
10.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¶
-
10.3. miplearn.collectors.basic¶
10.4. miplearn.extractors.fields¶
-
class
miplearn.extractors.fields.
H5FieldsExtractor
(instance_fields: Optional[List[str]] = None, var_fields: Optional[List[str]] = None, constr_fields: Optional[List[str]] = None)¶ Bases:
miplearn.extractors.abstract.FeaturesExtractor
-
get_constr_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶
-
get_instance_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶
-
get_var_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶
-
10.5. miplearn.extractors.AlvLouWeh2017¶
-
class
miplearn.extractors.AlvLouWeh2017.
AlvLouWeh2017Extractor
(with_m1: bool = True, with_m2: bool = True, with_m3: bool = True)¶ Bases:
miplearn.extractors.abstract.FeaturesExtractor
-
get_constr_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶
-
get_instance_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶
-
get_var_features
(h5: miplearn.h5.H5File) → numpy.ndarray¶ - Computes static variable features described in:
Alvarez, A. M., Louveaux, Q., & Wehenkel, L. (2017). A machine learning-based approximation of strong branching. INFORMS Journal on Computing, 29(1), 185-195.
-