timeseriescv

repository·master·Indexed 43 days ago

https://github.com/sam31415/timeseriescv

A Python package for specialized time series cross-validation designed to prevent data leakage. It provides PurgedWalkForwardCV and CombPurgedKFoldCV classes with a scikit-learn-like API, requiring predictor values, prediction times, and evaluation times to generate train and validation indices.

Tokens
253
Snippets
1
Records
3
Agent score
5%

What's inside timeseriescv

  1. Overview of timeseriescv cross-validation classes

    master

    The timeseriescv package provides two main classes for evaluating machine learning models on time series datasets where samples are tagged with prediction and evaluation times:

    • PurgedWalkForwardCV: Implements walk-forward cross-validation with purging.
    • CombPurgedKFoldCV: Implements combinatorial cross-validation with purging and embargoing.
  2. Use the split method with timeseriescv

    master

    The API is designed to be similar to scikit-learn. The split method is a generator that yields a pair of numpy arrays containing the positional indices for the train and validation sets.

    Key differences from scikit-learn:

    1. Required Arguments: The split method requires X (predictor values), pred_times (prediction times), and eval_times (evaluation times).
    2. Data Alignment: To ensure proper alignment, X, pred_times, and eval_times must be pandas DataFrames or Series that share the same index.