scikit-learn cross validation custom splits for time series data

后端 未结 3 528
不知归路
不知归路 2021-01-31 12:12

I\'d like to use scikit-learn\'s GridSearchCV to determine some hyper parameters for a random forest model. My data is time dependent and looks something like

i         


        
3条回答
  •  清歌不尽
    2021-01-31 12:42

    There is also the TimeSeriesSplit function in sklearn, which splits time-series data (i.e. with fixed time intervals), in train/test sets. Note that unlike standard cross-validation methods, successive training sets are supersets of those that come before them, i.e. in each split, test indices must be higher than before, and thus shuffling in cross validator is inappropriate.

提交回复
热议问题