1. Home
  2. Data Science
  3. Scikit-learn
  4. What is the purpose of the gap parameter in TimeSeriesSplit?

Added 30 Nov -0001

What is the purpose of the gap parameter in TimeSeriesSplit?

  1. It shifts the first training window forward, shrinking the initial train set
  2. It sets the minimum number of samples that each test fold must contain
  3. It drops samples between train and test to avoid leakage from overlap Correct answer
  4. It adds extra folds at the end, so the test set can be scored again

Correct answer

C. It drops samples between train and test to avoid leakage from overlap

41 views

MCQSEXAM

Explanation

TimeSeriesSplit never shuffles: each fold trains on the past and tests on the future, so the training window always precedes the test window. The gap parameter removes the last few training samples before each test block, which matters when features are built from rolling windows that would otherwise overlap the test period. It does not create extra folds; n_splits controls the number of splits.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs