Skip to main content

CPCV with Embargo for financial train-test splitting

Project description

Combinatorial Purged Cross-Validation with Embargo for Time Series Data

CPCV with Embargo prevents leakage in time series cross-validation by purging overlapping periods and applying an embargo around test folds.

Installation

pip install git+https://github.com/yosri-bh/cpcv-train-test-data-split-module.git

or

pip install cpcv

Usage

import pandas as pd
from cpcv import CPCV

df = pd.DataFrame({'feature': range(100)})
cpcv = CPCV(n_folds=5, test_size=1, embargo_pct=0.1)
splits = cpcv.split(df)

for train, test in splits:
    print(train.shape, test.shape)

Connect with Me

Thank you for visiting my GitHub profile! Feel free to reach out if you have any questions or opportunities to collaborate. Let's connect and explore new possibilities together:

GitHub LinkedIn Facebook Instagram Email Personal Web Page Google Drive PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpcv-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpcv-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file cpcv-0.1.0.tar.gz.

File metadata

  • Download URL: cpcv-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for cpcv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 87c8a138f0ddc5622c54ffdd3d93028afd878aaf63f646283f34caf75bf35441
MD5 99cc3a776193bf73bf1c66cfdc9be713
BLAKE2b-256 81a1acb9bd133b5ce6f1febc5dd4bd829161dfdd54fae17ac94d3b0388fa5aba

See more details on using hashes here.

File details

Details for the file cpcv-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cpcv-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for cpcv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1100946e124d64e74f44fcf69ba501b7490c59d119cdb9616bf9f657c32a4bf7
MD5 db283a50759f4a5472bb77a0e764f51e
BLAKE2b-256 5b4d9e187d803225cd0b68d265bd8723d4741dbaac7ae18220d95f675a11b086

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page