Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] gridsearch with RegressionModel #2104

Open
ETTAN93 opened this issue Dec 1, 2023 · 1 comment · May be fixed by #2594
Open

[BUG] gridsearch with RegressionModel #2104

ETTAN93 opened this issue Dec 1, 2023 · 1 comment · May be fixed by #2594
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ETTAN93
Copy link

ETTAN93 commented Dec 1, 2023

I am trying to implement grid search for 3 parameters in the elasticnet regression model from sklearn and wrapping the darts RegressionModel around that. Based on the documentation of grid search, this is how I initialised the grid search:

grid_params = {
    'max_iter': [1, 5, 10, 50, 100, 200],
    'alpha': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 0.0, 1.0, 10.0, 100.0],
    'l1_ratio': [0.01, 0.1, 0.3, 0.6, 0.9, 1]
}

sklearn_elasticnet_model = make_pipeline(
    ElasticNet(random_state = 42)
)

elasticnet_model = RegressionModel(
    lags=target_lags,
    lags_past_covariates=past_cov_lags, 
    lags_future_covariates=future_cov_lags,
    output_chunk_length=forecast_horizon,
    multi_models=True,
    model=sklearn_elasticnet_model
)

elasticnet_model.gridsearch(grid_params,
                            series=target_series_sample,
                            future_covariates=future_cov_sample,
                            forecast_horizon=24,
                            stride=24)

However, I am getting this error: TypeError: RegressionModel.__init__() got an unexpected keyword argument 'max_iter'. Am I implementing it wrongly?

@madtoinou madtoinou added the bug Something isn't working label Dec 6, 2023
@madtoinou
Copy link
Collaborator

Hi @ETTAN93,

Thank you for raising this issue. gridsearch() does not support the optimization of the parameters of the wrapped model at the moment, I added it to the roadmap.

@madtoinou madtoinou added the good first issue Good for newcomers label Dec 8, 2023
@madtoinou madtoinou changed the title How To Use Grid Search [BUG] gridsearch with RegressionModel Dec 12, 2023
@madtoinou madtoinou linked a pull request Nov 12, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
2 participants