{"id":40703942,"url":"https://github.com/dssg/timechop","last_synced_at":"2026-01-21T12:08:43.052Z","repository":{"id":57475536,"uuid":"78146956","full_name":"dssg/timechop","owner":"dssg","description":"generate time splits for temporal validation","archived":false,"fork":false,"pushed_at":"2018-01-27T21:46:36.000Z","size":117,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-06-09T20:36:00.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dssg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-05T20:45:11.000Z","updated_at":"2020-08-24T07:48:31.000Z","dependencies_parsed_at":"2022-09-07T13:51:07.211Z","dependency_job_id":null,"html_url":"https://github.com/dssg/timechop","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/dssg/timechop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dssg%2Ftimechop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dssg%2Ftimechop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dssg%2Ftimechop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dssg%2Ftimechop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dssg","download_url":"https://codeload.github.com/dssg/timechop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dssg%2Ftimechop/sbom","scorecard":{"id":358029,"data":{"date":"2025-08-11","repo":{"name":"github.com/dssg/timechop","commit":"805f8b640b75fd644ad9108643197e64e6ac26f2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":4,"reason":"Found 8/20 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-238 / GHSA-h3qr-fjhm-jphw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T10:06:11.013Z","repository_id":57475536,"created_at":"2025-08-18T10:06:11.013Z","updated_at":"2025-08-18T10:06:11.013Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28632781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-21T12:08:42.240Z","updated_at":"2026-01-21T12:08:43.041Z","avatar_url":"https://github.com/dssg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timechop\n\n[![Build Status](https://travis-ci.org/dssg/timechop.svg?branch=master)](https://travis-ci.org/dssg/timechop)\n[![codecov](https://codecov.io/gh/dssg/timechop/branch/master/graph/badge.svg)](https://codecov.io/gh/dssg/timechop)\n[![codeclimate](https://codeclimate.com/github/dssg/timechop.png)](https://codeclimate.com/github/dssg/timechop)\n\nGenerate temporal validation time windows for matrix creation\n\n**Note**: Timechop is now a bundled component of [Triage](https://github.com/dssg/triage), and future development will take place there. To utilize Timechop within your custom pipeline, you may still import it from there.\n\n---\n\nIn predictive analytics, temporal validation can be complicated. There are a variety of questions to balance: How frequently to retrain models? Should the time between rows for the same entity in the train and test matrices be different? Keeping track of how to create matrix time windows that successfully answer all of these questions is difficult. \n\nThat's why we created timechop. Timechop takes in high-level time configuration (e.g. lists of train label spans, test data frequencies) and returns all matrix time definitions. \n\n\nTimechop currently works with the following:\n\n- feature_start_time - data aggregated into features begins at this point\n- feature_end_time - data aggregated into features is from *before* this point\n- label_start_time - data aggregated into labels begins at this point\n- label_end_time - data aggregated is from *before* this point\n- model_update_frequency - amount of time between train/test splits\n- training_as_of_date_frequencies - how much time between rows for a single entity in a training matrix\n- max_training_histories - the maximum amount of history for each entity to train on (early matrices may contain less than this time if it goes past label/feature start times)\n- training_label_timespans - how much time is covered by training labels (e.g., outcomes in the next 1 year? 3 days? 2 months?)\n- test_as_of_date_frequencies - how much time between rows for a single entity in a test matrix\n- test_durations - how far into the future should a model be used to make predictions (in the typical case of wanting a single prediction set immediately after model training, this should be set to 0 days)\n- test_label_timespans - how much time is covered by test predictions (e.g., outcomes in the next 1 year? 3 days? 2 months?)\n\nHere's an example of a typical set-up with a single prediction immediately after training and models built at an annual frequency:\n```\nfrom timechop.timechop import Timechop\n\nchopper = Timechop(\n    feature_start_time=datetime.datetime(1990, 1, 1, 0, 0), \n    feature_end_time=datetime.datetime(2017, 1, 1, 0, 0),\n    label_start_time=datetime.datetime(2014, 1, 1, 0, 0),\n    label_end_time=datetime.datetime(2017, 1, 1, 0, 0),\n    model_update_frequency='1 year',\n    training_as_of_date_frequencies=['6 months'],\n    max_training_histories=['2 years'],\n    training_label_timespans=['6 months'],\n    test_as_of_date_frequencies=['1 days'],\n    test_durations=['0 days'],\n    test_label_timespans=['6 months']\n)\nresult = chopper.chop_time()\nprint(result)\n```\n```\n[\n    {\n        'feature_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'feature_start_time': datetime.datetime(1990, 1, 1, 0, 0),\n        'label_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'label_start_time': datetime.datetime(2014, 1, 1, 0, 0),\n        'test_matrices': [{\n            'as_of_times': [\n                datetime.datetime(2014, 7, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2014, 7, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2014, 7, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2015, 1, 1, 0, 0),\n            'test_as_of_date_frequency': '1 days',\n            'test_label_timespan': '6 months',\n            'test_duration': '0 days'\n        }],\n        'train_matrix': {\n            'as_of_times': [\n                datetime.datetime(2014, 1, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2014, 1, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2014, 1, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2014, 7, 1, 0, 0),\n            'max_training_history': '2 years',\n            'training_as_of_date_frequency': '6 months',\n            'training_label_timespan': '6 months'\n        }\n    },\n    {\n        'feature_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'feature_start_time': datetime.datetime(1990, 1, 1, 0, 0),\n        'label_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'label_start_time': datetime.datetime(2014, 1, 1, 0, 0),\n        'test_matrices': [{\n            'as_of_times': [\n                datetime.datetime(2015, 7, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2015, 7, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2015, 7, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2016, 1, 1, 0, 0),\n            'test_as_of_date_frequency': '1 days',\n            'test_label_timespan': '6 months',\n            'test_duration': '0 days'\n        }],\n        'train_matrix': {\n            'as_of_times': [\n                datetime.datetime(2014, 1, 1, 0, 0),\n                datetime.datetime(2014, 7, 1, 0, 0),\n                datetime.datetime(2015, 1, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2015, 1, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2014, 1, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2015, 7, 1, 0, 0),\n            'max_training_history': '2 years',\n            'training_as_of_date_frequency': '6 months',\n            'training_label_timespan': '6 months'\n        }\n    },\n    {\n        'feature_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'feature_start_time': datetime.datetime(1990, 1, 1, 0, 0),\n        'label_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n        'label_start_time': datetime.datetime(2014, 1, 1, 0, 0),\n        'test_matrices': [{\n            'as_of_times': [\n                datetime.datetime(2016, 7, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2016, 7, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2016, 7, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2017, 1, 1, 0, 0),\n            'test_as_of_date_frequency': '1 days',\n            'test_label_timespan': '6 months',\n            'test_duration': '0 days'\n        }],\n        'train_matrix': {\n            'as_of_times': [\n                datetime.datetime(2014, 1, 1, 0, 0),\n                datetime.datetime(2014, 7, 1, 0, 0),\n                datetime.datetime(2015, 1, 1, 0, 0),\n                datetime.datetime(2015, 7, 1, 0, 0),\n                datetime.datetime(2016, 1, 1, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2016, 1, 1, 0, 0),\n            'first_as_of_time': datetime.datetime(2014, 1, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2016, 7, 1, 0, 0),\n            'max_training_history': '2 years',\n            'training_as_of_date_frequency': '6 months',\n            'training_label_timespan': '6 months'\n        }\n    }\n]\n```\n\n\nAnd a second example with multiple testing dates and showing how the train matrices behave at the edge cases, showing the effects of some of the other paramters:\n\n```\nfrom timechop.timechop import Timechop\n\nchopper = Timechop(\n\tfeature_start_time=datetime.datetime(1990, 1, 1, 0, 0), \n    feature_end_time=datetime.datetime(2010, 1, 16, 0, 0),\n    label_start_time=datetime.datetime(2010, 1, 1, 0, 0),\n    label_end_time=datetime.datetime(2010, 1, 16, 0, 0),\n    model_update_frequency='5 days',\n    training_as_of_date_frequencies=['1 days'],\n    max_training_histories=['5 days'],\n    training_label_timespans=['1 day'],\n    test_as_of_date_frequencies=['3 days'],\n    test_durations=['5 days'],\n    test_label_timespans=['3 days']\n)\nresult = chopper.chop_time()\nprint(result)\n```\n\n```\n[\n    {\n        'feature_end_time': datetime.datetime(2010, 1, 16, 0, 0),\n        'feature_start_time': datetime.datetime(1990, 1, 1, 0, 0),\n        'label_end_time': datetime.datetime(2010, 1, 16, 0, 0),\n        'label_start_time': datetime.datetime(2010, 1, 1, 0, 0),\n        'test_matrices': [{\n            'as_of_times': [\n                datetime.datetime(2010, 1, 3, 0, 0),\n                datetime.datetime(2010, 1, 6, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2010, 1, 6, 0, 0),\n            'first_as_of_time': datetime.datetime(2010, 1, 3, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2010, 1, 9, 0, 0),\n            'test_as_of_date_frequency': '3 days',\n            'test_label_timespan': '3 days',\n            'test_duration': '5 days'\n        }],\n        'train_matrix': {\n            'as_of_times': [\n                datetime.datetime(2010, 1, 1, 0, 0),\n                datetime.datetime(2010, 1, 2, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2010, 1, 2, 0, 0),\n            'first_as_of_time': datetime.datetime(2010, 1, 1, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2010, 1, 3, 0, 0),\n            'max_training_history': '5 days',\n            'training_as_of_date_frequency': '1 days',\n            'training_label_timespan': '1 day'\n        }\n    },\n    {\n        'feature_end_time': datetime.datetime(2010, 1, 16, 0, 0),\n        'feature_start_time': datetime.datetime(1990, 1, 1, 0, 0),\n        'label_end_time': datetime.datetime(2010, 1, 16, 0, 0),\n        'label_start_time': datetime.datetime(2010, 1, 1, 0, 0),\n        'test_matrices': [{\n            'as_of_times': [\n                datetime.datetime(2010, 1, 8, 0, 0),\n                datetime.datetime(2010, 1, 11, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2010, 1, 11, 0, 0),\n            'first_as_of_time': datetime.datetime(2010, 1, 8, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2010, 1, 14, 0, 0),\n            'test_as_of_date_frequency': '3 days',\n            'test_label_timespan': '3 days',\n            'test_duration': '5 days'\n        }],\n        'train_matrix': {\n            'as_of_times': [\n                datetime.datetime(2010, 1, 2, 0, 0),\n                datetime.datetime(2010, 1, 3, 0, 0),\n                datetime.datetime(2010, 1, 4, 0, 0),\n                datetime.datetime(2010, 1, 5, 0, 0),\n                datetime.datetime(2010, 1, 6, 0, 0),\n                datetime.datetime(2010, 1, 7, 0, 0)\n            ],\n            'last_as_of_time': datetime.datetime(2010, 1, 7, 0, 0),\n            'first_as_of_time': datetime.datetime(2010, 1, 2, 0, 0),\n            'matrix_info_end_time': datetime.datetime(2010, 1, 8, 0, 0),\n            'max_training_history': '5 days',\n            'training_as_of_date_frequency': '1 days',\n            'training_label_timespan': '1 day'\n        }\n    }\n]\n```\n\nThe output of Timechop works as input to the [architect.Planner](https://github.com/dssg/architect/blob/master/architect/planner.py).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdssg%2Ftimechop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdssg%2Ftimechop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdssg%2Ftimechop/lists"}