File size: 997 Bytes
829e3ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

"""
This module defines the setup for performing Linear Regression with hyperparameter tuning.

Features:
- Sets up a `LinearRegression` estimator from scikit-learn.
- Defines a hyperparameter grid for preprocessing and model-specific parameters.
- Specifies an optional default scoring metric for evaluating the model.

Special Considerations:
- Linear Regression doesn't typically require special handling.
- Applying a log transformation to the target variable (`log_transform`) can be beneficial if it's skewed.
"""

from sklearn.linear_model import LinearRegression

# Define the estimator
estimator = LinearRegression()

# Define the hyperparameter grid
param_grid = {
    'model__fit_intercept': [True, False],
    'preprocessor__num__imputer__strategy': ['mean', 'median'],
    'preprocessor__num__scaler__with_mean': [True, False],
    'preprocessor__num__scaler__with_std': [True, False],
}

# Optional: Define the default scoring metric
default_scoring = 'neg_root_mean_squared_error'