AI4S2S / s2spy

A high-level python package integrating expert knowledge and artificial intelligence to boost (sub) seasonal forecasting
https://ai4s2s.readthedocs.io/
Apache License 2.0
20 stars 7 forks source link

Nested cross-validation #90

Open Peter9192 opened 2 years ago

Peter9192 commented 2 years ago

We've been talking about nested cross-validation. Scikit-learn actually has a nice example of this. In essence, it looks like this:

inner_cv = KFold(n_splits=4, shuffle=True, random_state=i)
outer_cv = KFold(n_splits=4, shuffle=True, random_state=i)

clf = GridSearchCV(estimator=svm, param_grid=p_grid, cv=inner_cv)

# Note that the gridsearch instance is passed into the outer cv
score = cross_val_score(clf, X=X_iris, y=y_iris, cv=outer_cv).mean()

It would be nice if we could eventually do the same, but for that we need to make sure our model/pipeline can work with xarray data structures.

related to AI4S2S/s2spy#71 AI4S2S/lilio#46