class getml.predictors.LogisticRegression(learning_rate=0.9, reg_lambda=1e-10)[source]

Simple predictor for classification problems.

Learns a simple linear relationship using the sigmoid function:

\[\hat{y} = \sigma(w_0 + w_1 * feature_1 + w_2 * feature_2 + ...)\]

\(\sigma\) denotes the sigmoid function:

\[\sigma(z) = \frac{1}{1 + exp(-z)}\]

The weights are optimized by minimizing the cross entropy loss of the predictions \(\hat{y}\) w.r.t. the targets \(y\).

\[L(\hat{y},y) = - y*\log \hat{y} - (1 - y)*\log(1 - \hat{y})\]

Logistic regressions are always trained numerically.

If you decide to pass categorical features to the LogisticRegression, it will be trained using the Broyden-Fletcher-Goldfarb-Shannon (BFGS) algorithm. Otherwise, it will be trained using adaptive moments (Adam). BFGS is more accurate, but less scalable than Adam.


learning_rate (float, optional):

The learning rate used for the Adaptive Moments algorithm (only relevant when categorical features are included). Range: (0, \(\infty\)]

reg_lambda (float, optional):

L2 regularization parameter. Range: [0, \(\infty\)]

TypeError: If any of the input arguments does not match its

expected type.



Checks both the types and the values of all instance variables and raises an exception if something is off.