Source code for evalml.pipelines.components.estimators.regressors.linear_regressor

from sklearn.linear_model import LinearRegression as SKLinearRegression

from evalml.model_family import ModelFamily
from evalml.pipelines.components.estimators import Estimator
from evalml.problem_types import ProblemTypes


[docs]class LinearRegressor(Estimator): """Linear Regressor.""" name = "Linear Regressor" hyperparameter_ranges = { 'fit_intercept': [True, False], 'normalize': [True, False] } model_family = ModelFamily.LINEAR_MODEL supported_problem_types = [ProblemTypes.REGRESSION, ProblemTypes.TIME_SERIES_REGRESSION]
[docs] def __init__(self, fit_intercept=True, normalize=False, n_jobs=-1, random_state=0, **kwargs): parameters = { 'fit_intercept': fit_intercept, 'normalize': normalize, 'n_jobs': n_jobs } parameters.update(kwargs) linear_regressor = SKLinearRegression(**parameters) super().__init__(parameters=parameters, component_obj=linear_regressor, random_state=random_state)
@property def feature_importance(self): return self._component_obj.coef_