unit8co/darts

[BUG] gridsearch with RegressionModel

Open

#2104 aperta il 1 dic 2023

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Python (762 fork)batch import
buggood first issue

Metriche repository

Star
 (6832 star)
Metriche merge PR
 (Merge medio 143g 16h) (16 PR mergiate in 30 g)

Descrizione

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?

Guida contributor