dask_ml.linear_model.LinearRegression
dask_ml.linear_model
.LinearRegression¶
- class dask_ml.linear_model.LinearRegression(penalty='l2', dual=False, tol=0.0001, C=1.0, fit_intercept=True, intercept_scaling=1.0, class_weight=None, random_state=None, solver='admm', max_iter=100, multi_class='ovr', verbose=0, warm_start=False, n_jobs=1, solver_kwargs=None)¶
Esimator for linear regression.
- Parameters
- penaltystr or Regularizer, default ‘l2’
Regularizer to use. Only relevant for the ‘admm’, ‘lbfgs’ and ‘proximal_grad’ solvers.
For string values, only ‘l1’ or ‘l2’ are valid.
- dualbool
Ignored
- tolfloat, default 1e-4
The tolerance for convergence.
- Cfloat
Regularization strength. Note that
dask-glm
solvers use the parameterization \(\lambda = 1 / C\)- fit_interceptbool, default True
Specifies if a constant (a.k.a. bias or intercept) should be added to the decision function.
- intercept_scalingbool
Ignored
- class_weightdict or ‘balanced’
Ignored
- random_stateint, RandomState, or None
The seed of the pseudo random number generator to use when shuffling the data. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Used when solver == ‘sag’ or ‘liblinear’.
- solver{‘admm’, ‘gradient_descent’, ‘newton’, ‘lbfgs’, ‘proximal_grad’}
Solver to use. See Algorithms for details
- max_iterint, default 100
Maximum number of iterations taken for the solvers to converge.
- multi_classstr, default ‘ovr’
Ignored. Multiclass solvers not currently supported.
- verboseint, default 0
Ignored
- warm_startbool, default False
Ignored
- n_jobsint, default 1
Ignored
- solver_kwargsdict, optional, default None
Extra keyword arguments to pass through to the solver.
- Attributes
- coef_array, shape (n_classes, n_features)
The learned value for the model’s coefficients
- intercept_float of None
The learned value for the intercept, if one was added to the model
Examples
>>> from dask_glm.datasets import make_regression >>> X, y = make_regression() >>> lr = LinearRegression() >>> lr.fit(X, y) >>> lr.predict(X) >>> lr.predict(X) >>> lr.score(X, y)
Methods
fit
(X[, y])Fit the model on the training data
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
predict
(X)Predict values for samples in X.
score
(X, y)Returns the coefficient of determination R^2 of the prediction.
set_params
(**params)Set the parameters of this estimator.
- __init__(penalty='l2', dual=False, tol=0.0001, C=1.0, fit_intercept=True, intercept_scaling=1.0, class_weight=None, random_state=None, solver='admm', max_iter=100, multi_class='ovr', verbose=0, warm_start=False, n_jobs=1, solver_kwargs=None)¶