Parsing of API parameters commonly used in sklearn: sklearn.linear_model.LinearRegression
This article introduces the "sklearn commonly used API parameter analysis: sklearn.linear_model.LinearRegression" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Sklearn.linear_model.LinearRegression
Call
Sklearn.linear_model.LinearRegression (fit_intercept=True, normalize=False, copy_X=True, n_jobs=None)
Parameters
Fit_intercept
Interpretation: whether to calculate the intercept of the model.
Setting: Bool type, optional, default True, if you use centralized data, you can consider setting it to False, regardless of intercept.
Normalize
Interpretation: whether to standardize the data
Setting: Bool type, optional, default False, it is recommended to put standardization before the training model, by setting sklearn.preprocessing.StandardScaler to achieve, and here set to false when fit_intercept is set to false, this parameter will be automatically ignored. If True, the regression standardizes the input parameters: minus the average and dividing by the corresponding two-norm
Copy_X
Interpretation: whether to copy X
Setting: Bool type, optional, default True. If false, the new data will be overwritten on the original data after centralization and standardization.
N_jobs
Definition: the number of tasks set when calculating. This parameter accelerates the problem that the number of targets > 1 (n_targets > 1) and is large enough.
Setting: int or None, optional, default None. If you choose-1, all CPU will be used.
Attributes
Coef_
Interpretation: the coefficient of feature calculated for linear regression problems
Output: if the input is a multi-objective problem, return a two-dimensional array (n_targets, n_features); if it is a single-objective problem, return an one-dimensional array (n_features,) rank_
Interpretation: the rank of a matrix X is valid only if X is a dense matrix
Output: rank of matrix X
Singular_
Interpretation: the singular value of a matrix X is valid only when X is a dense matrix
Output: array of shape (min (X, y),)
Intercept_
Interpretation: intercept, independent term in linear model
Output: if fit_intercept = False, intercept_ is 0.0
Methods
Fit (self, X, y [, sample_weight])
Training model, sample_weight is the weight value of each sample, default None
Get_params (self [, deep])
Deep defaults to True and returns a dictionary. The key is the parameter name and the value is the estimator parameter value.
Predict (self, X)
Model prediction, return the predicted value
Score (self, X, y [, sample_weight])
Model evaluation, return R ^ 2 coefficient, the optimal value is 1, indicating that all data are predicted correctly
Set_params (self, * * params)
Set the parameters of the estimator, you can modify the parameters and retrain
This is the end of the content of "parsing API parameters commonly used by sklearn: sklearn.linear_model.LinearRegression". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!