# Demand Patterns SBC (Syntetos Boylan Croston) method of Categorizations
## Description
This method helps classify different demand patterns (time-series patterns) into groups in order to fit the most appropriate model. More info could be found [here](https://www.researchgate.net/publication/28578603_On_the_categorization_of_demand_patterns) and [here](https://robjhyndman.com/papers/SBC-categorization.pdf)
This is a Python version of the tsintermittent package in R. At the moment, only the SBC method is available.
## Installation
`pip install sbc-classification`
## Example
### Test Data
Test data is the clean version of the data from M5 Forecasting Challenge competition on Kaggle. Details can be found [here](https://www.kaggle.com/competitions/m5-forecasting-accuracy/data). The dataset was processed to make it easier to test the function.
<div style="width:85%; margin:0 auto">
<img src="example/test_input.png">
</div>
<br>
### Testing
<b>Note:</b> This function will not treat NA values. All the null values in the time-series should be treated separately.
```python
from sbc import sbc_class.sbc_class
df = pd.read_csv("./tests/data/sales_train_clean.csv")
## multiple targets
out = sbc_class.(df.iloc[:, 1:], plot_type = 'summary')
## 1 target
out1 = sbc_class.(df.iloc[:, 1], plot_type = 'summary')
print(out)
print(out1)
```
If plot_type is not None, output would be a plot and a dataframe of target_name, p, CV squared and classified model type for multiple targets
<div style="width:85%; margin:0 auto">
<img src="example/output_multiple.png">
</div>
<br>
If plot_type is `summary` then the plot would be a matrix diagram of numbers of time-series in each category
<div style="width:85%; margin:0 auto">
<img src="example/output_multiple_summary.png">
</div>
<br>
If plot_type is `bar` then the plot would be bar chart of numbers of time-series in each demand patterns
<div style="width:85%; margin:0 auto">
<img src="example/output_multiple_bar.png">
</div>
<br>
Please give the package a star if you find it helpful :)
Raw data
{
"_id": null,
"home_page": "https://github.com/tqn14/SBC_classification_python",
"name": "sbc-classification",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,demand patterns,sbc classification,croston,idclass,tsintermittent",
"author": "Thu Nguyen",
"author_email": "tqn1472@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e1/a1/8ad3fd24666414e5549ddb6b55eede44fcba2502e107c2e0567125104ca9/sbc-classification-0.0.4.tar.gz",
"platform": null,
"description": "# Demand Patterns SBC (Syntetos Boylan Croston) method of Categorizations\n\n## Description\nThis method helps classify different demand patterns (time-series patterns) into groups in order to fit the most appropriate model. More info could be found [here](https://www.researchgate.net/publication/28578603_On_the_categorization_of_demand_patterns) and [here](https://robjhyndman.com/papers/SBC-categorization.pdf) \n\nThis is a Python version of the tsintermittent package in R. At the moment, only the SBC method is available.\n\n## Installation\n`pip install sbc-classification`\n\n\n## Example\n### Test Data\n\nTest data is the clean version of the data from M5 Forecasting Challenge competition on Kaggle. Details can be found [here](https://www.kaggle.com/competitions/m5-forecasting-accuracy/data). The dataset was processed to make it easier to test the function.\n\n<div style=\"width:85%; margin:0 auto\">\n <img src=\"example/test_input.png\">\n</div>\n<br>\n\n\n### Testing\n<b>Note:</b> This function will not treat NA values. All the null values in the time-series should be treated separately.\n\n```python\nfrom sbc import sbc_class.sbc_class\n\ndf = pd.read_csv(\"./tests/data/sales_train_clean.csv\")\n## multiple targets\nout = sbc_class.(df.iloc[:, 1:], plot_type = 'summary')\n## 1 target\nout1 = sbc_class.(df.iloc[:, 1], plot_type = 'summary')\n\nprint(out)\nprint(out1)\n```\n\nIf plot_type is not None, output would be a plot and a dataframe of target_name, p, CV squared and classified model type for multiple targets \n\n<div style=\"width:85%; margin:0 auto\">\n <img src=\"example/output_multiple.png\">\n</div>\n<br>\n\nIf plot_type is `summary` then the plot would be a matrix diagram of numbers of time-series in each category \n\n<div style=\"width:85%; margin:0 auto\">\n <img src=\"example/output_multiple_summary.png\">\n</div>\n<br>\n\nIf plot_type is `bar` then the plot would be bar chart of numbers of time-series in each demand patterns \n\n<div style=\"width:85%; margin:0 auto\">\n <img src=\"example/output_multiple_bar.png\">\n</div>\n<br>\n\nPlease give the package a star if you find it helpful :)\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Demand Patterns SBC (Syntetos, Boylan, Croston) method of Categorizations",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/tqn14/SBC_classification_python"
},
"split_keywords": [
"python",
"demand patterns",
"sbc classification",
"croston",
"idclass",
"tsintermittent"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe1e531ad181eb20395ab54955b6f5a3b7693be50b279972b0ea65b6777eeddf",
"md5": "fd4272eafee2fba3e71c3e67e0cc9955",
"sha256": "c002c32270de32f2dff8022066277652cfd0777ac499941c35f3c177a005dcf8"
},
"downloads": -1,
"filename": "sbc_classification-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd4272eafee2fba3e71c3e67e0cc9955",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6441,
"upload_time": "2023-07-28T03:09:04",
"upload_time_iso_8601": "2023-07-28T03:09:04.433627Z",
"url": "https://files.pythonhosted.org/packages/fe/1e/531ad181eb20395ab54955b6f5a3b7693be50b279972b0ea65b6777eeddf/sbc_classification-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e1a18ad3fd24666414e5549ddb6b55eede44fcba2502e107c2e0567125104ca9",
"md5": "641ebcb5d74c54720edddfb9ea14299b",
"sha256": "5426b22087952c3de3a02bc0cf90bce5ddcc1de96de0b9f8285cbe3a3150e06d"
},
"downloads": -1,
"filename": "sbc-classification-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "641ebcb5d74c54720edddfb9ea14299b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5613,
"upload_time": "2023-07-28T03:09:05",
"upload_time_iso_8601": "2023-07-28T03:09:05.439846Z",
"url": "https://files.pythonhosted.org/packages/e1/a1/8ad3fd24666414e5549ddb6b55eede44fcba2502e107c2e0567125104ca9/sbc-classification-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-28 03:09:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tqn14",
"github_project": "SBC_classification_python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sbc-classification"
}