LinearRegression¶

class
getml.predictors.
LinearRegression
(learning_rate: float = 0.9, reg_lambda: float = 1e10)[source]¶ Simple predictor for regression problems.
Learns a simple linear relationship using ordinary least squares (OLS) regression:
\[\hat{y} = w_0 + w_1 * feature_1 + w_2 * feature_2 + ...\]The weights are optimized by minimizing the squared loss of the predictions \(\hat{y}\) w.r.t. the targets \(y\).
\[L(y,\hat{y}) = \frac{1}{n} \sum_{i=1}^{n} (y_i \hat{y}_i)^2\]Linear regressions can be trained arithmetically or numerically. Training arithmetically is more accurate, but suffers worse scalability.
If you decide to pass categorical features to the
LinearRegression
, it will be trained numerically. Otherwise, it will be trained arithmetically. Args:
 learning_rate (float, optional):
The learning rate used for training numerically (only relevant when categorical features are included). Range: (0, \(\infty\)]
 reg_lambda (float, optional):
L2 regularization parameter. Range: [0, \(\infty\)]
Methods
validate
([params])Checks both the types and the values of all instance variables and raises an exception if something is off.
Attributes