hyperimpute.plugins.prediction.classifiers.plugin_logistic_regression module

class LogisticRegressionPlugin(C: float = 1.0, solver: int = 1, multi_class: int = 0, class_weight: int = 0, max_iter: int = 10000, penalty: str = 'l2', model: Optional[Any] = None, random_state: int = 0, hyperparam_search_iterations: Optional[int] = None, **kwargs: Any)

Bases: ClassifierPlugin

Classification plugin based on the Logistic Regression classifier.

Method:

Logistic regression is a linear model for classification rather than regression. In this model, the probabilities describing the possible outcomes of a single trial are modeled using a logistic function.

Parameters:
  • C – float Inverse of regularization strength; must be a positive float.

  • solver – str Algorithm to use in the optimization problem: [‘newton-cg’, ‘lbfgs’, ‘liblinear’, ‘sag’, ‘saga’]

  • multi_class – str If the option chosen is ‘ovr’, then a binary problem is fit for each label. For ‘multinomial’ the loss minimised is the multinomial loss fit across the entire probability distribution, even when the data is binary. ‘multinomial’ is unavailable when solver=’liblinear’. ‘auto’ selects ‘ovr’ if the data is binary, or if solver=’liblinear’, and otherwise selects ‘multinomial’.

  • class_weight – str Weights associated with classes in the form {class_label: weight}. If not given, all classes are supposed to have weight one.

  • max_iter – int Maximum number of iterations taken for the solvers to converge.

Example

>>> from hyperimpute.plugins.prediction import Predictions
>>> plugin = Predictions(category="classifiers").get("logistic_regression")
>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> plugin.fit_predict(X, y) # returns the probabilities for each class
_abc_impl = <_abc_data object>
_fit(X: DataFrame, *args: Any, **kwargs: Any) LogisticRegressionPlugin
_predict(X: DataFrame, *args: Any, **kwargs: Any) DataFrame
_predict_proba(X: DataFrame, *args: Any, **kwargs: Any) DataFrame
classes = ['auto', 'ovr', 'multinomial']
static hyperparameter_space(*args: Any, **kwargs: Any) List[Params]
module_relative_path: Optional[Path]
static name() str
solvers = ['newton-cg', 'lbfgs', 'sag', 'saga']
weights = ['balanced', None]
plugin

alias of LogisticRegressionPlugin