title: BlockingTimeSeriesSplit returnd best score nan
body: <p>I've used <code>TimeSeriesSplit</code> from sklearn and a customized <code>BlockingTimeSeriesSplit</code> with a <code>GridSearchCV</code> object to tune a XGB model (<a href="https://stackoverflow.com/questions/46732748/how-do-i-use-a-timeseriessplit-with-a-gridsearchcv-object-to-tune-a-model-in-sci">pls check an example from this link</a>),</p>
  <pre><code>import xgboost as xgb
  from sklearn.model_selection import TimeSeriesSplit, GridSearchCV
  import numpy as np
  
  class BlockingTimeSeriesSplit():
      def __init__(self, n_splits):
          self.n_splits = n_splits
  
      def get_n_splits(self, X, y, groups):
          return self.n_splits
  
      def split(self, X, y=None, groups=None):
          n_samples = len(X)
          k_fold_size = n_samples // self.n_splits
          indices = np.arange(n_samples)
  
          margin = 0
          for i in range(self.n_splits):
              start = i * k_fold_size
              stop = start + k_fold_size
              mid = int(0.8 * (stop - start)) + start
              yield indices[start: mid], indices[mid + margin: stop]
  
  for k_fold in range(2, 4, 1):
      print(k_fold)
      print('*'*50)
      sklearn_tscv = BlockingTimeSeriesSplit(n_splits=k_fold)
      blocked_tscv = TimeSeriesSplit(n_splits=k_fold)
      split_methods = [sklearn_tscv, blocked_tscv]
      for split_method in split_methods:
          X = np.array([[4, 5, 6, 1, 0, 2, 7, 3, 5], [3.1, 3.5, 1.0, 2.1, 8.3, 1.1, 2, 4, 6]]).T
          y = np.array([1, 6, 7, 1, 2, 3, 1, 3, 7])
          
          model = xgb.XGBRegressor()
          param_search = {'max_depth' : [3, 5]}
          
          tscv = TimeSeriesSplit(n_splits=2)
          gsearch = GridSearchCV(estimator=model, cv=split_method,
                                  param_grid=param_search)
          gsearch.fit(X, y)
          print(gsearch.fit(X, y))
          print('Best score reached: {} with params: {} '.format(gsearch.best_score_, gsearch.best_params_))
  </code></pre>
  <p>Out:</p>
  <pre><code>2
  **************************************************
  GridSearchCV(cv=&lt;__main__.BlockingTimeSeriesSplit object at 0x0000016303A6A070&gt;,
               estimator=XGBRegressor(base_score=None, booster=None,
                                      colsample_bylevel=None,
                                      colsample_bynode=None,
                                      colsample_bytree=None, gamma=None,
                                      gpu_id=None, importance_type='gain',
                                      interaction_constraints=None,
                                      learning_rate=None, max_delta_step=None,
                                      max_depth=None, min_child_weight=None,
                                      missing=nan, monotone_constraints=None,
                                      n_estimators=100, n_jobs=None,
                                      num_parallel_tree=None, random_state=None,
                                      reg_alpha=None, reg_lambda=None,
                                      scale_pos_weight=None, subsample=None,
                                      tree_method=None, validate_parameters=None,
                                      verbosity=None),
               param_grid={'max_depth': [3, 5]})
  Best score reached: nan with params: {'max_depth': 3} 
  GridSearchCV(cv=TimeSeriesSplit(gap=0, max_train_size=None, n_splits=2, test_size=None),
               estimator=XGBRegressor(base_score=None, booster=None,
                                      colsample_bylevel=None,
                                      colsample_bynode=None,
                                      colsample_bytree=None, gamma=None,
                                      gpu_id=None, importance_type='gain',
                                      interaction_constraints=None,
                                      learning_rate=None, max_delta_step=None,
                                      max_depth=None, min_child_weight=None,
                                      missing=nan, monotone_constraints=None,
                                      n_estimators=100, n_jobs=None,
                                      num_parallel_tree=None, random_state=None,
                                      reg_alpha=None, reg_lambda=None,
                                      scale_pos_weight=None, subsample=None,
                                      tree_method=None, validate_parameters=None,
                                      verbosity=None),
               param_grid={'max_depth': [3, 5]})
  Best score reached: -1.1467339258845848 with params: {'max_depth': 3} 
  3
  **************************************************
  GridSearchCV(cv=&lt;__main__.BlockingTimeSeriesSplit object at 0x0000016303AF39A0&gt;,
               estimator=XGBRegressor(base_score=None, booster=None,
                                      colsample_bylevel=None,
                                      colsample_bynode=None,
                                      colsample_bytree=None, gamma=None,
                                      gpu_id=None, importance_type='gain',
                                      interaction_constraints=None,
                                      learning_rate=None, max_delta_step=None,
                                      max_depth=None, min_child_weight=None,
                                      missing=nan, monotone_constraints=None,
                                      n_estimators=100, n_jobs=None,
                                      num_parallel_tree=None, random_state=None,
                                      reg_alpha=None, reg_lambda=None,
                                      scale_pos_weight=None, subsample=None,
                                      tree_method=None, validate_parameters=None,
                                      verbosity=None),
               param_grid={'max_depth': [3, 5]})
  Best score reached: nan with params: {'max_depth': 3} 
  GridSearchCV(cv=TimeSeriesSplit(gap=0, max_train_size=None, n_splits=3, test_size=None),
               estimator=XGBRegressor(base_score=None, booster=None,
                                      colsample_bylevel=None,
                                      colsample_bynode=None,
                                      colsample_bytree=None, gamma=None,
                                      gpu_id=None, importance_type='gain',
                                      interaction_constraints=None,
                                      learning_rate=None, max_delta_step=None,
                                      max_depth=None, min_child_weight=None,
                                      missing=nan, monotone_constraints=None,
                                      n_estimators=100, n_jobs=None,
                                      num_parallel_tree=None, random_state=None,
                                      reg_alpha=None, reg_lambda=None,
                                      scale_pos_weight=None, subsample=None,
                                      tree_method=None, validate_parameters=None,
                                      verbosity=None),
               param_grid={'max_depth': [3, 5]})
  Best score reached: -6.440679569353013 with params: {'max_depth': 3}
  </code></pre>
  <p>But as you can see, <code>BlockingTimeSeriesSplit</code> always returns <code>Best score reached: nan with params: {'max_depth': 3} </code>.</p>
  <p>I would like to ask if this result is because the dataset is too small or something else. Thanks.</p>
  <p>Reference:</p>
  <p><a href="https://hub.packtpub.com/cross-validation-strategies-for-time-series-forecasting-tutorial/" rel="nofollow noreferrer">https://hub.packtpub.com/cross-validation-strategies-for-time-series-forecasting-tutorial/</a></p>