- class mars.learn.linear_model.LinearRegression(*, fit_intercept=True, normalize=False, copy_X=True, positive=False)#
Ordinary least squares Linear Regression.
LinearRegression fits a linear model with coefficients w = (w1, …, wp) to minimize the residual sum of squares between the observed targets in the dataset, and the targets predicted by the linear approximation.
fit_intercept (bool, default=True) – Whether to calculate the intercept for this model. If set to False, no intercept will be used in calculations (i.e. data is expected to be centered).
normalize (bool, default=False) – This parameter is ignored when
fit_interceptis set to False. If True, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm. If you wish to standardize, please use
fiton an estimator with
copy_X (bool, default=True) – If True, X will be copied; else, it may be overwritten.
positive (bool, default=False) – When set to
True, forces the coefficients to be positive. This option is only supported for dense arrays.
Estimated coefficients for the linear regression problem. If multiple targets are passed during the fit (y 2D), this is a 2D array of shape (n_targets, n_features), while if only one target is passed, this is a 1D array of length n_features.
array of shape (n_features, ) or (n_targets, n_features)
Singular values of X. Only available when X is dense.
array of shape (min(X, y),)
Independent term in the linear model. Set to 0.0 if fit_intercept = False.
float or array of shape (n_targets,)
Ridge regression addresses some of the problems of Ordinary Least Squares by imposing a penalty on the size of the coefficients with l2 regularization.
The Lasso is a linear model that estimates sparse coefficients with l1 regularization.
Elastic-Net is a linear regression model trained with both l1 and l2 -norm regularization of the coefficients.
- __init__(*, fit_intercept=True, normalize=False, copy_X=True, positive=False)#
__init__(*[, fit_intercept, normalize, ...])
fit(X, y[, sample_weight])
Fit linear model.
Get parameters for this estimator.
Predict using the linear model.
score(X, y[, sample_weight])
Return the coefficient of determination \(R^2\) of the prediction.
Set the parameters of this estimator.