{"id":14958311,"url":"https://github.com/heidelbergcement/hcrystalball","last_synced_at":"2025-04-05T06:10:21.215Z","repository":{"id":42523007,"uuid":"275794599","full_name":"heidelbergcement/hcrystalball","owner":"heidelbergcement","description":"A library that unifies the API for most commonly used libraries and modeling techniques for time-series forecasting in the Python ecosystem.","archived":false,"fork":false,"pushed_at":"2024-02-21T09:24:08.000Z","size":11386,"stargazers_count":151,"open_issues_count":17,"forks_count":20,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-03T16:11:33.937Z","etag":null,"topics":["cross-validation","data-science","fbprophet","model-selection","pmdarima","sarimax","sklearn","sklearn-api","sklearn-compatible","sklearn-library","sktime","statsmodels","tbats","time-series","time-series-forecasting","transformer","wrapper"],"latest_commit_sha":null,"homepage":"https://hcrystalball.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heidelbergcement.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-29T11:31:26.000Z","updated_at":"2024-10-21T12:46:21.000Z","dependencies_parsed_at":"2024-06-18T15:19:35.079Z","dependency_job_id":"913add65-e8ec-4269-b617-a3467d8a638b","html_url":"https://github.com/heidelbergcement/hcrystalball","commit_stats":{"total_commits":225,"total_committers":9,"mean_commits":25.0,"dds":0.5866666666666667,"last_synced_commit":"eeb32b936b3621c3d73b2bde7760ffb3882292e9"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heidelbergcement%2Fhcrystalball","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heidelbergcement%2Fhcrystalball/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heidelbergcement%2Fhcrystalball/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heidelbergcement%2Fhcrystalball/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heidelbergcement","download_url":"https://codeload.github.com/heidelbergcement/hcrystalball/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cross-validation","data-science","fbprophet","model-selection","pmdarima","sarimax","sklearn","sklearn-api","sklearn-compatible","sklearn-library","sktime","statsmodels","tbats","time-series","time-series-forecasting","transformer","wrapper"],"created_at":"2024-09-24T13:16:43.371Z","updated_at":"2025-04-05T06:10:21.199Z","avatar_url":"https://github.com/heidelbergcement.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/heidelbergcement/hcrystalball/workflows/CI/badge.svg)](https://github.com/heidelbergcement/hcrystalball/actions/?query=workflow%3ACI)\n[![CD](https://github.com/heidelbergcement/hcrystalball/workflows/CD/badge.svg)](https://github.com/heidelbergcement/hcrystalball/actions?query=workflow%3ACD)\n[![Documentation Status](https://readthedocs.org/projects/hcrystalball/badge/?version=latest)](https://hcrystalball.readthedocs.io/en/latest/?badge=latest)\n[![PyPI Version](https://img.shields.io/pypi/v/hcrystalball)](https://pypi.org/project/hcrystalball/)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/hcrystalball)](https://anaconda.org/conda-forge/hcrystalball)\n[![Code Coverage](https://codecov.io/gh/heidelbergcement/hcrystalball/branch/master/graph/badge.svg)](https://codecov.io/gh/heidelbergcement/hcrystalball)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/heidelbergcement/hcrystalball/master?filepath=docs/examples/)\n[![License](https://img.shields.io/github/license/heidelbergcement/hcrystalball)](https://raw.githubusercontent.com/heidelbergcement/hcrystalball/master/LICENSE.txt)\n[![Contributors](https://img.shields.io/github/contributors/heidelbergcement/hcrystalball)](https://github.com/heidelbergcement/hcrystalball/graphs/contributors)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# HCrystal Ball\n\n\u003cdiv\u003e\n    \u003ca href=\"https://hcrystalball.readthedocs.io/en/latest/\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/heidelbergcement/hcrystalball/master/docs/_static/hcrystal_ball_logo_green.png\"    width=\"150px\" align=\"left\" /\u003e\u003c/a\u003e\n    \u003ci\u003e\u003cbr\u003eA library that unifies the API for most commonly \u003cbr\u003e\n    used libraries and modelling techniques for time-series \u003cbr\u003e\n    forecasting in the Python ecosystem.\u003c/i\u003e\n\u003c/div\u003e\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n**HCrystal Ball** consists of two main parts:\n\n* **Wrappers** - which bring different 3rd party\n   libraries to time series compatible sklearn API\n* **Model Selection** - to enable gridsearch over wrappers, general or custom made transformers\n   and add convenient layer over whole process (access to results, plots, storage, ...)\n\n## Documentation\nSee examples, tutorials, contribution, API and more on the documentation [site](https://hcrystalball.readthedocs.io/en/latest) try notebooks on [binder](https://mybinder.org/v2/gh/heidelbergcement/hcrystalball/master) or browse example notebooks in [docs/examples](https://github.com/heidelbergcement/hcrystalball/tree/master/docs/examples) directly.\n\n## Core Installation\n\nIf you want really minimal installation, you can install from pip or from conda-forge\n\n```bash\npip install hcrystalball\n```\n\n```bash\nconda install -c conda-forge hcrystalball\n```\n\n## Typical Installation\n\nVery often you will want to use more wrappers, than just Sklearn, run examples in jupyterlab, or execute model selection in parallel. Getting such dependencies to play together nicely might be cumbersome, so checking `envrionment.yml` might give you faster start.\n\n```bash\n# get dependencies file, e.g. using curl\ncurl -O https://raw.githubusercontent.com/heidelbergcement/hcrystalball/master/environment.yml\n# check comments in environment.yml, keep or remove as requested, than create environment using\nconda env create -f environment.yml\n# activate the environment\nconda activate hcrystalball\n# if you want to see progress bar in jupyterlab, execute also\njupyter labextension install @jupyter-widgets/jupyterlab-manager\n# install the library from pip\npip install hcrystalball\n# or from conda\nconda install -c conda-forge hcrystalball\n```\n\n## Development Installation:\n\nTo have everything in place including docs build or executing tests, execute following code\n\n```bash\ngit clone https://github.com/heidelbergcement/hcrystalball\ncd hcrystalball\nconda env create -f environment.yml\nconda activate hcrystalball\n# ensures interactive progress bar will work in example notebooks\njupyter labextension install @jupyter-widgets/jupyterlab-manager\npython setup.py develop\n```\n\n## Example Usage\n### Wrappers\n```python\nfrom hcrystalball.utils import generate_tsdata\nfrom hcrystalball.wrappers import ProphetWrapper\n\nX, y = generate_tsdata(n_dates=365*2)\nX_train, y_train, X_test, y_test = X[:-10], y[:-10], X[-10:], y[-10:]\n\nmodel = ProphetWrapper()\ny_pred = model.fit(X_train, y_train).predict(X_test)\ny_pred\n            prophet\n2018-12-22  6.066999\n2018-12-23  6.050076\n2018-12-24  6.105620\n2018-12-25  6.141953\n2018-12-26  6.150229\n2018-12-27  6.163615\n2018-12-28  6.147420\n2018-12-29  6.048633\n2018-12-30  6.031711\n2018-12-31  6.087255\n```\n\n### Model Selection\n\n```python\nimport pandas as pd\nimport matplotlib.pyplot as plt\nplt.style.use('seaborn')\nplt.rcParams['figure.figsize'] = [12, 6]\n\nfrom hcrystalball.utils import get_sales_data\nfrom hcrystalball.model_selection import ModelSelector\n\ndf = get_sales_data(n_dates=200,\n                    n_assortments=1,\n                    n_states=2,\n                    n_stores=2)\n\nms = ModelSelector(horizon=10,\n                   frequency=\"D\",\n                   country_code_column=\"HolidayCode\",\n                   )\n\nms.create_gridsearch(n_splits=2,\n                     sklearn_models=True,\n                     prophet_models=False,\n                     exog_cols=[\"Open\",\"Promo\",\"SchoolHoliday\",\"Promo2\"],\n                     )\n\nms.select_model(df=df,\n                target_col_name=\"Sales\",\n                partition_columns=[\"Assortment\", \"State\",\"Store\"],\n                )\n\nms.plot_results(plot_from=\"2015-06-01\",\n                partitions=[{\"Assortment\":\"a\",\"State\":\"NW\",\"Store\":335}]\n               )\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/heidelbergcement/hcrystalball/master/docs/_static/forecast.png\" width=\"100%\" align=\"left\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheidelbergcement%2Fhcrystalball","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheidelbergcement%2Fhcrystalball","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheidelbergcement%2Fhcrystalball/lists"}