getml.predictors.LogisticRegression
dataclass
Bases: _Predictor
Simple predictor for classification problems.
Learns a simple linear relationship using the sigmoid function:
\(\sigma\) denotes the sigmoid function:
The weights are optimized by minimizing the cross entropy loss of the predictions \(\hat{y}\) w.r.t. the targets \(y\).
Logistic regressions are always trained numerically.
If you decide to pass categorical
features: annotating_roles_categorical
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.
PARAMETER | DESCRIPTION |
---|---|
learning_rate |
The learning rate used for the Adaptive Moments algorithm (only relevant when categorical features are included). Range: (0, ∞]
TYPE:
|
reg_lambda |
L2 regularization parameter. Range: [0, ∞]
TYPE:
|
validate
Checks both the types and the values of all instance variables and raises an exception if something is off.
PARAMETER | DESCRIPTION |
---|---|
params |
A dictionary containing the parameters to validate. If not is passed, the own parameters will be validated. |
Examples:
l = getml.predictors.LogisticRegression()
l.learning_rate = 20
l.validate()
Note
This method is called at end of the __init__
constructor
and every time before the predictor - or a class holding
it as an instance variable - is sent to the getML Engine.
Source code in getml/predictors/logistic_regression.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|