Skip to content

Adding purged cross-validation for time series datasets #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cross-validation/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "Cross validation",
"description": "A collection of whizzml scripts and libraries performing k-fold cross-validation",
"kind": "package",
"components": ["cross-validation-gen", "basic", "model", "ensemble", "logistic-regression", "boosted-ensemble", "deepnet", "supervised-conf", "linear-regression"]
"components": ["cross-validation-gen", "basic", "model", "ensemble", "logistic-regression", "boosted-ensemble", "deepnet", "supervised-conf", "linear-regression", "purged-cross-validation"]
}
6 changes: 6 additions & 0 deletions cross-validation/purged-cross-validation/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Purged k-fold cross-validation script",
"description": "The objective of this script is performing a purged k-fold cross validation of any supervised model built from a time-series like already sorted dataset. The algorithm:\n\n - Divides the dataset in k parts\n - Holds out the data in one of the parts and builds a supervised model\n with the rest of data\n - Removes the edges of the hold out dataset to create the test dataset (avoiding leakage).\n- Evaluates the supervised model with the purged test dataset\n - The second, third and fourth steps are repeated with each of the k parts, so that\n k evaluations are generated\n - Finally, the evaluation metrics are averaged to provide the cross-validation\n metrics.\n\n The **goal** of the script is producing a\n cross-validation, an evaluation whose metrics are averages of the k evaluations\n created in the cross-validation process.\n\n For more information, please see the [readme](https://github.com/whizzml/examples/tree/master/cross-validation/purged-cross-validation).",
"kind": "script",
"source_code": "script.whizzml"
}
18 changes: 18 additions & 0 deletions cross-validation/purged-cross-validation/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Script for purged k-fold cross-validation

The objective of this script is create a purged k-fold cross validation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to create

starting form any classification model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: from

built from a time-series kind of dataset that has been previously ordered.

The algorithm:

- Divides the dataset in k parts
- Holds out the data in one of the parts and builds the same supervised model
used as input with the rest of data
- Creates a test dataset by purging its edges (15% of the hold out data) to
avoid leakage.
- Evaluates the model with the test data
- The second, third and fourth steps are repeated with each of the k parts,
so that k evaluations are generated
- Finally, the evaluation metrics are averaged to provide the cross-validation
metrics.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note outside the scope of this PR: it'd be nice if in the metadata's description we could use a pointer to a file, something like:

"description": {"file": "./readme.md"}

Loading