Name | PipelineTS JSON |
Version |
0.3.12
JSON |
| download |
home_page | https://github.com/BirchKwok/PipelineTS |
Summary | One-stop time series analysis tool, supporting time series data preprocessing, feature engineering, model training, model evaluation, model prediction, etc. Based on spinesTS and darts. |
upload_time | 2024-05-13 03:49:53 |
maintainer | None |
docs_url | None |
author | Birch Kwok |
requires_python | >=3.9 |
license | None |
keywords |
time
series
forecasting
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PipelineTS
![PyPI](https://img.shields.io/pypi/v/PipelineTS)
![PyPI - License](https://img.shields.io/pypi/l/PipelineTS)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PipelineTS)
[![Downloads](https://pepy.tech/badge/pipelinets)](https://pepy.tech/project/pipelinets)
[![Downloads](https://pepy.tech/badge/pipelinets/month)](https://pepy.tech/project/pipelinets)
[![Downloads](https://pepy.tech/badge/pipelinets/week)](https://pepy.tech/project/pipelinets)
[\[中文文档\]](https://github.com/BirchKwok/PipelineTS/blob/main/README_CN.md)
One-stop time series analysis tool, supporting time series data preprocessing, feature engineering, model training, model evaluation, model prediction, etc. Based on spinesTS and darts.
## Installation
```bash
# if you don't want to use the prophet model
# run this
python -m pip install PipelineTS[core]
# if you want to use all models
# run this
python -m pip install PipelineTS[all]
```
## Quick Start [\[notebook\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/QuickStart.ipynb)
### list all available models
```python
from PipelineTS.dataset import LoadWebSales
init_data = LoadWebSales()[['date', 'type_a']]
valid_data = init_data.iloc[-30:, :]
data = init_data.iloc[:-30, :]
accelerator = 'auto' # Specify Computing Device
from PipelineTS.pipeline import ModelPipeline
# list all models
ModelPipeline.list_all_available_models()
```
```
[output]:
['prophet',
'auto_arima',
'catboost',
'lightgbm',
'xgboost',
'wide_gbrt',
'd_linear',
'n_linear',
'n_beats',
'n_hits',
'tcn',
'tft',
'gau',
'stacking_rnn',
'time2vec',
'multi_output_model',
'multi_step_model',
'transformer',
'random_forest',
'tide']
```
### Training
```python
from sklearn.metrics import mean_absolute_error
pipeline = ModelPipeline(
time_col='date',
target_col='type_a',
lags=30,
random_state=42,
metric=mean_absolute_error,
metric_less_is_better=True,
accelerator=accelerator, # Supported values for accelerator: `auto`, `cpu`, `tpu`, `cuda`, `mps`.
)
# training all models
pipeline.fit(data, valid_data=valid_data)
# use best model to predict next 30 steps data point
res = pipeline.predict(30)
```
## Training and prediction of a single model
### Without predict specify series [\[notebook\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/modeling.ipynb)
<details>
<summary>Code</summary>
```python
from PipelineTS.dataset import LoadMessagesSentDataSets
import pandas as pd
# ------------------- Data Preprocessing -------------------
# convert time col, the date column is assumed to be date_col
time_col = 'date'
target_col = 'ta'
lags = 60 # Ahead of the window size, the data will be split into multiple sequences of lags for training
n = 40 # How many steps to predict, in this case how many days to predict
# you can also load data with pandas
# init_data = pd.read_csv('/path/to/your/data.csv')
init_data = LoadMessagesSentDataSets()[[time_col, target_col]]
init_data[time_col] = pd.to_datetime(init_data[time_col], format='%Y-%m-%d')
# split trainning set and test set
valid_data = init_data.iloc[-n:, :]
data = init_data.iloc[:-n, :]
print("data shape: ", data.shape, ", valid data shape: ", valid_data.shape)
data.tail(5)
# data visualization
from PipelineTS.plot import plot_data_period
plot_data_period(
data.iloc[-300:, :],
valid_data,
time_col=time_col,
target_col=target_col,
labels=['Train data', 'Valid_data']
)
# training and predict
from PipelineTS.nn_model import TiDEModel
tide = TiDEModel(
time_col=time_col, target_col=target_col, lags=lags, random_state=42,
quantile=0.9, enable_progress_bar=False, enable_model_summary=False
)
tide.fit(data)
tide.predict(n)
```
</details>
### With predict specify series [\[notebook\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/modeling-with-predict-specify-series.ipynb)
<details>
<summary>Code</summary>
```python
from PipelineTS.dataset import LoadMessagesSentDataSets
import pandas as pd
# ------------------- Data Preprocessing -------------------
# convert time col, the date column is assumed to be date_col
time_col = 'date'
target_col = 'ta'
lags = 60 # Ahead of the window size, the data will be split into multiple sequences of lags for training
n = 40 # How many steps to predict, in this case how many days to predict
# you can also load data with pandas
# init_data = pd.read_csv('/path/to/your/data.csv')
init_data = LoadMessagesSentDataSets()[[time_col, target_col]]
init_data[time_col] = pd.to_datetime(init_data[time_col], format='%Y-%m-%d')
# split trainning set and test set
valid_data = init_data.iloc[-n:, :]
data = init_data.iloc[:-n, :]
print("data shape: ", data.shape, ", valid data shape: ", valid_data.shape)
data.tail(5)
# data visualization
from PipelineTS.plot import plot_data_period
plot_data_period(
data.iloc[-300:, :],
valid_data,
time_col=time_col,
target_col=target_col,
labels=['Train data', 'Valid_data']
)
# training and predict
from PipelineTS.nn_model import TiDEModel
tide = TiDEModel(
time_col=time_col, target_col=target_col, lags=lags, random_state=42,
quantile=0.9, enable_progress_bar=False, enable_model_summary=False
)
tide.fit(data)
tide.predict(n, data=valid_data)
```
</details>
## ModelPipeline Module
```python
# If you need to configure the model
from xgboost import XGBRegressor
from catboost import CatBoostRegressor
from PipelineTS.pipeline import ModelPipeline, PipelineConfigs
# If you want to try multiple configurations of a model at once for comparison or tuning purposes, you can use `PipelineConfigs`.
# This feature allows for customizing the models returned by each `ModelPipeline.list_all_available_models()` call.
# The first one is the name of the model, which needs to be in the list of available models provided by ModelPipeline.list_all_available_models().
# If you want to customize the name of the model, then the second argument can be a string of the model name,
# otherwise, the second one is of type dict. The dict can have three keys: 'init_configs', 'fit_configs', 'predict_configs', or any combination of them.
# The remaining keys will be automatically filled with default parameters.
# Among them, 'init_configs' represents the initialization parameters of the model, 'fit_configs' represents the parameters during model training,
# and 'predict_configs' represents the parameters during model prediction.
pipeline_configs = PipelineConfigs([
('lightgbm', 'lightgbm_linear_tree', {'init_configs': {'verbose': -1, 'linear_tree': True}}),
('multi_output_model', {'init_configs': {'verbose': -1}}),
('multi_step_model', {'init_configs': {'verbose': -1}}),
('multi_output_model', {
'init_configs': {'estimator': XGBRegressor, 'random_state': 42, 'kwargs': {'verbosity': 0}}
}
),
('multi_output_model', {
'init_configs': {'estimator': CatBoostRegressor, 'random_state': 42, 'verbose': False}
}
),
])
```
<table>
<thead>
<tr><th style="text-align: right;"> </th><th>model_name </th><th>model_name_after_rename </th><th>model_configs </th></tr>
</thead>
<tbody>
<tr><td style="text-align: right;"> 0</td><td>lightgbm </td><td>lightgbm_linear_tree </td><td>{'init_configs': {'verbose': -1, 'linear_tree': True}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>
<tr><td style="text-align: right;"> 1</td><td>multi_output_model</td><td>multi_output_model_1 </td><td>{'init_configs': {'verbose': -1}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>
<tr><td style="text-align: right;"> 2</td><td>multi_output_model</td><td>multi_output_model_2 </td><td>{'init_configs': {'estimator': <class 'xgboost.sklearn.XGBRegressor'>, 'random_state': 42, 'kwargs': {'verbosity': 0}}, 'fit_configs': {}, 'predict_configs': {}}</td></tr>
<tr><td style="text-align: right;"> 3</td><td>multi_output_model</td><td>multi_output_model_3 </td><td>{'init_configs': {'estimator': <class 'catboost.core.CatBoostRegressor'>, 'random_state': 42, 'verbose': False}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>
<tr><td style="text-align: right;"> 4</td><td>multi_step_model </td><td>multi_step_model_1 </td><td>{'init_configs': {'verbose': -1}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>
</tbody>
</table>
### Non-Interval Forecasting [\[notebook\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/pipeline.ipynb)
```python
from sklearn.metrics import mean_absolute_error
from PipelineTS.pipeline import ModelPipeline
pipeline = ModelPipeline(
time_col=time_col,
target_col=target_col,
lags=lags,
random_state=42,
metric=mean_absolute_error,
metric_less_is_better=True,
configs=pipeline_configs,
include_init_config_model=False,
scaler=False, # False for MinMaxScaler, True for StandardScaler, None means no data be scaled
# include_models=['d_linear', 'random_forest', 'n_linear', 'n_beats'], # specifying the model used
# exclude_models=['catboost', 'tcn', 'transformer'], # exclude specified models
# Note that `include_models` and `exclude_models` cannot be specified simultaneously.
accelerator=accelerator,
# Now we can directly input the "modelname__'init_params'" parameter to instantiate the models in ModelPipeline.
# Note that it is double underline.
# When it is duplicated with the ModelPipeline class keyword parameter, the ModelPipeline clas keyword parameter is ignored
d_linear__lags=50,
n_linear__random_state=1024,
n_beats__num_blocks=3,
random_forest__n_estimators=200,
n_hits__accelerator='cpu', # Since using mps backend for n_hits model on mac gives an error, cpu backend is used as an alternative
tft__accelerator='cpu', # tft, same question, but if you use cuda backend, you can just ignore this two configurations.
)
pipeline.fit(data, valid_data)
```
#### Get the model parameters in ModelPipeline
```python
# Gets all configurations for the specified model, default to best model
pipeline.get_model_all_configs(model_name='wide_gbrt')
```
#### Plotting the forecast results
```python
# use best model to predict next 30 steps data point
prediction = pipeline.predict(n, model_name=None) # You can use `model_name` to specify the pre-trained model in the pipeline when using Python.
plot_data_period(init_data.iloc[-100:, :], prediction,
time_col=time_col, target_col=target_col)
```
![image1](https://github.com/BirchKwok/PipelineTS/blob/main/pics/pic2.png)
### Interval prediction [\[notebook\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/pipeline-with-quantile-prediction.ipynb)
```python
from sklearn.metrics import mean_absolute_error
from PipelineTS.pipeline import ModelPipeline
pipeline = ModelPipeline(
time_col=time_col,
target_col=target_col,
lags=lags,
random_state=42,
metric=mean_absolute_error,
metric_less_is_better=True,
configs=pipeline_configs,
include_init_config_model=False,
scaler=False,
with_quantile_prediction=True, # turn on the quantile prediction switch, if you like
accelerator=accelerator,
# models=['wide_gbrt'] # Specify the model
n_hits__accelerator='cpu',
tft__accelerator='cpu',
)
pipeline.fit(data, valid_data)
```
#### Plotting the forecast results
```python
# use best model to predict next 30 steps data point
prediction = pipeline.predict(n, model_name=None) # You can use `model_name` to specify the pre-trained model in the pipeline when using Python.
plot_data_period(init_data.iloc[-100:, :], prediction,
time_col=time_col, target_col=target_col)
```
![image1](https://github.com/BirchKwok/PipelineTS/blob/main/pics/pic3.png)
## Model and ModelPipeline saving and loading
```python
from PipelineTS.io import load_model, save_model
# save
save_model(path='/path/to/save/your/fitted_model_or_pipeline.zip', model=pipeline)
# load
pipeline = load_model('/path/to/save/your/fitted_model_or_pipeline.zip')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/BirchKwok/PipelineTS",
"name": "PipelineTS",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "time series forecasting",
"author": "Birch Kwok",
"author_email": "birchkwok@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ca/31/dd3265ea9d4d1c3835ae0e05da7b1b48e1efe88326264d73b5784d7281ed/pipelinets-0.3.12.tar.gz",
"platform": null,
"description": "# PipelineTS\n\n![PyPI](https://img.shields.io/pypi/v/PipelineTS)\n![PyPI - License](https://img.shields.io/pypi/l/PipelineTS)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PipelineTS)\n[![Downloads](https://pepy.tech/badge/pipelinets)](https://pepy.tech/project/pipelinets)\n[![Downloads](https://pepy.tech/badge/pipelinets/month)](https://pepy.tech/project/pipelinets)\n[![Downloads](https://pepy.tech/badge/pipelinets/week)](https://pepy.tech/project/pipelinets)\n\n[\\[\u4e2d\u6587\u6587\u6863\\]](https://github.com/BirchKwok/PipelineTS/blob/main/README_CN.md)\n\nOne-stop time series analysis tool, supporting time series data preprocessing, feature engineering, model training, model evaluation, model prediction, etc. Based on spinesTS and darts.\n## Installation\n\n```bash\n# if you don't want to use the prophet model\n# run this\npython -m pip install PipelineTS[core]\n\n# if you want to use all models\n# run this\npython -m pip install PipelineTS[all]\n```\n\n## Quick Start [\\[notebook\\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/QuickStart.ipynb)\n\n### list all available models\n```python\nfrom PipelineTS.dataset import LoadWebSales\n\ninit_data = LoadWebSales()[['date', 'type_a']]\n\nvalid_data = init_data.iloc[-30:, :]\ndata = init_data.iloc[:-30, :]\naccelerator = 'auto' # Specify Computing Device\n\nfrom PipelineTS.pipeline import ModelPipeline\n\n# list all models\nModelPipeline.list_all_available_models()\n```\n\n```\n[output]:\n['prophet',\n 'auto_arima',\n 'catboost',\n 'lightgbm',\n 'xgboost',\n 'wide_gbrt',\n 'd_linear',\n 'n_linear',\n 'n_beats',\n 'n_hits',\n 'tcn',\n 'tft',\n 'gau',\n 'stacking_rnn',\n 'time2vec',\n 'multi_output_model',\n 'multi_step_model',\n 'transformer',\n 'random_forest',\n 'tide']\n```\n\n### Training\n```python\nfrom sklearn.metrics import mean_absolute_error\n\npipeline = ModelPipeline(\n time_col='date',\n target_col='type_a',\n lags=30,\n random_state=42,\n metric=mean_absolute_error,\n metric_less_is_better=True,\n accelerator=accelerator, # Supported values for accelerator: `auto`, `cpu`, `tpu`, `cuda`, `mps`.\n)\n\n# training all models\npipeline.fit(data, valid_data=valid_data)\n\n# use best model to predict next 30 steps data point\nres = pipeline.predict(30)\n\n```\n\n## Training and prediction of a single model\n### Without predict specify series [\\[notebook\\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/modeling.ipynb)\n<details>\n<summary>Code</summary>\n\n```python\n\nfrom PipelineTS.dataset import LoadMessagesSentDataSets\nimport pandas as pd\n\n# ------------------- Data Preprocessing -------------------\n# convert time col, the date column is assumed to be date_col\ntime_col = 'date'\ntarget_col = 'ta'\nlags = 60 # Ahead of the window size, the data will be split into multiple sequences of lags for training\nn = 40 # How many steps to predict, in this case how many days to predict\n\n# you can also load data with pandas\n# init_data = pd.read_csv('/path/to/your/data.csv')\ninit_data = LoadMessagesSentDataSets()[[time_col, target_col]]\n\ninit_data[time_col] = pd.to_datetime(init_data[time_col], format='%Y-%m-%d')\n\n# split trainning set and test set\nvalid_data = init_data.iloc[-n:, :]\ndata = init_data.iloc[:-n, :]\nprint(\"data shape: \", data.shape, \", valid data shape: \", valid_data.shape)\ndata.tail(5)\n\n# data visualization\nfrom PipelineTS.plot import plot_data_period\nplot_data_period(\n data.iloc[-300:, :], \n valid_data, \n time_col=time_col, \n target_col=target_col, \n labels=['Train data', 'Valid_data']\n)\n\n# training and predict\nfrom PipelineTS.nn_model import TiDEModel\ntide = TiDEModel(\n time_col=time_col, target_col=target_col, lags=lags, random_state=42, \n quantile=0.9, enable_progress_bar=False, enable_model_summary=False\n)\ntide.fit(data)\ntide.predict(n)\n\n```\n</details>\n\n### With predict specify series [\\[notebook\\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/modeling-with-predict-specify-series.ipynb)\n\n<details>\n<summary>Code</summary>\n\n```python\n\nfrom PipelineTS.dataset import LoadMessagesSentDataSets\nimport pandas as pd\n\n# ------------------- Data Preprocessing -------------------\n# convert time col, the date column is assumed to be date_col\ntime_col = 'date'\ntarget_col = 'ta'\nlags = 60 # Ahead of the window size, the data will be split into multiple sequences of lags for training\nn = 40 # How many steps to predict, in this case how many days to predict\n\n# you can also load data with pandas\n# init_data = pd.read_csv('/path/to/your/data.csv')\ninit_data = LoadMessagesSentDataSets()[[time_col, target_col]]\n\ninit_data[time_col] = pd.to_datetime(init_data[time_col], format='%Y-%m-%d')\n\n# split trainning set and test set\nvalid_data = init_data.iloc[-n:, :]\ndata = init_data.iloc[:-n, :]\nprint(\"data shape: \", data.shape, \", valid data shape: \", valid_data.shape)\ndata.tail(5)\n\n# data visualization\nfrom PipelineTS.plot import plot_data_period\nplot_data_period(\n data.iloc[-300:, :], \n valid_data, \n time_col=time_col, \n target_col=target_col, \n labels=['Train data', 'Valid_data']\n)\n\n# training and predict\nfrom PipelineTS.nn_model import TiDEModel\ntide = TiDEModel(\n time_col=time_col, target_col=target_col, lags=lags, random_state=42, \n quantile=0.9, enable_progress_bar=False, enable_model_summary=False\n)\ntide.fit(data)\ntide.predict(n, data=valid_data)\n```\n\n</details>\n\n\n## ModelPipeline Module\n\n```python\n# If you need to configure the model\nfrom xgboost import XGBRegressor\nfrom catboost import CatBoostRegressor\nfrom PipelineTS.pipeline import ModelPipeline, PipelineConfigs\n\n# If you want to try multiple configurations of a model at once for comparison or tuning purposes, you can use `PipelineConfigs`.\n# This feature allows for customizing the models returned by each `ModelPipeline.list_all_available_models()` call.\n# The first one is the name of the model, which needs to be in the list of available models provided by ModelPipeline.list_all_available_models(). \n# If you want to customize the name of the model, then the second argument can be a string of the model name, \n# otherwise, the second one is of type dict. The dict can have three keys: 'init_configs', 'fit_configs', 'predict_configs', or any combination of them. \n# The remaining keys will be automatically filled with default parameters.\n# Among them, 'init_configs' represents the initialization parameters of the model, 'fit_configs' represents the parameters during model training, \n# and 'predict_configs' represents the parameters during model prediction.\n\npipeline_configs = PipelineConfigs([\n ('lightgbm', 'lightgbm_linear_tree', {'init_configs': {'verbose': -1, 'linear_tree': True}}),\n ('multi_output_model', {'init_configs': {'verbose': -1}}),\n ('multi_step_model', {'init_configs': {'verbose': -1}}),\n ('multi_output_model', {\n 'init_configs': {'estimator': XGBRegressor, 'random_state': 42, 'kwargs': {'verbosity': 0}}\n }\n ),\n ('multi_output_model', {\n 'init_configs': {'estimator': CatBoostRegressor, 'random_state': 42, 'verbose': False}\n }\n ),\n])\n```\n<table>\n<thead>\n<tr><th style=\"text-align: right;\"> </th><th>model_name </th><th>model_name_after_rename </th><th>model_configs </th></tr>\n</thead>\n<tbody>\n<tr><td style=\"text-align: right;\"> 0</td><td>lightgbm </td><td>lightgbm_linear_tree </td><td>{'init_configs': {'verbose': -1, 'linear_tree': True}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>\n<tr><td style=\"text-align: right;\"> 1</td><td>multi_output_model</td><td>multi_output_model_1 </td><td>{'init_configs': {'verbose': -1}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>\n<tr><td style=\"text-align: right;\"> 2</td><td>multi_output_model</td><td>multi_output_model_2 </td><td>{'init_configs': {'estimator': <class 'xgboost.sklearn.XGBRegressor'>, 'random_state': 42, 'kwargs': {'verbosity': 0}}, 'fit_configs': {}, 'predict_configs': {}}</td></tr>\n<tr><td style=\"text-align: right;\"> 3</td><td>multi_output_model</td><td>multi_output_model_3 </td><td>{'init_configs': {'estimator': <class 'catboost.core.CatBoostRegressor'>, 'random_state': 42, 'verbose': False}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>\n<tr><td style=\"text-align: right;\"> 4</td><td>multi_step_model </td><td>multi_step_model_1 </td><td>{'init_configs': {'verbose': -1}, 'fit_configs': {}, 'predict_configs': {}} </td></tr>\n</tbody>\n</table>\n\n### Non-Interval Forecasting [\\[notebook\\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/pipeline.ipynb)\n\n```python\nfrom sklearn.metrics import mean_absolute_error\n\nfrom PipelineTS.pipeline import ModelPipeline\n\npipeline = ModelPipeline(\n time_col=time_col, \n target_col=target_col, \n lags=lags, \n random_state=42, \n metric=mean_absolute_error, \n metric_less_is_better=True,\n configs=pipeline_configs,\n include_init_config_model=False,\n scaler=False, # False for MinMaxScaler, True for StandardScaler, None means no data be scaled\n # include_models=['d_linear', 'random_forest', 'n_linear', 'n_beats'], # specifying the model used\n # exclude_models=['catboost', 'tcn', 'transformer'], # exclude specified models\n # Note that `include_models` and `exclude_models` cannot be specified simultaneously.\n accelerator=accelerator,\n # Now we can directly input the \"modelname__'init_params'\" parameter to instantiate the models in ModelPipeline.\n # Note that it is double underline. \n # When it is duplicated with the ModelPipeline class keyword parameter, the ModelPipeline clas keyword parameter is ignored\n d_linear__lags=50,\n n_linear__random_state=1024,\n n_beats__num_blocks=3,\n random_forest__n_estimators=200,\n n_hits__accelerator='cpu', # Since using mps backend for n_hits model on mac gives an error, cpu backend is used as an alternative\n tft__accelerator='cpu', # tft, same question, but if you use cuda backend, you can just ignore this two configurations.\n)\n\npipeline.fit(data, valid_data)\n```\n\n#### Get the model parameters in ModelPipeline\n```python\n# Gets all configurations for the specified model\uff0c default to best model\npipeline.get_model_all_configs(model_name='wide_gbrt')\n```\n\n#### Plotting the forecast results\n```python\n# use best model to predict next 30 steps data point\nprediction = pipeline.predict(n, model_name=None) # You can use `model_name` to specify the pre-trained model in the pipeline when using Python.\n\nplot_data_period(init_data.iloc[-100:, :], prediction, \n time_col=time_col, target_col=target_col)\n```\n\n![image1](https://github.com/BirchKwok/PipelineTS/blob/main/pics/pic2.png)\n\n### Interval prediction [\\[notebook\\]](https://github.com/BirchKwok/PipelineTS/blob/main/examples/pipeline-with-quantile-prediction.ipynb)\n\n```python\nfrom sklearn.metrics import mean_absolute_error\n\nfrom PipelineTS.pipeline import ModelPipeline\n\npipeline = ModelPipeline(\n time_col=time_col,\n target_col=target_col,\n lags=lags,\n random_state=42,\n metric=mean_absolute_error,\n metric_less_is_better=True,\n configs=pipeline_configs,\n include_init_config_model=False,\n scaler=False,\n with_quantile_prediction=True, # turn on the quantile prediction switch, if you like\n accelerator=accelerator,\n # models=['wide_gbrt'] # Specify the model\n n_hits__accelerator='cpu',\n tft__accelerator='cpu',\n)\n\npipeline.fit(data, valid_data)\n```\n\n#### Plotting the forecast results\n```python\n# use best model to predict next 30 steps data point\nprediction = pipeline.predict(n, model_name=None) # You can use `model_name` to specify the pre-trained model in the pipeline when using Python.\n\nplot_data_period(init_data.iloc[-100:, :], prediction, \n time_col=time_col, target_col=target_col)\n```\n![image1](https://github.com/BirchKwok/PipelineTS/blob/main/pics/pic3.png)\n\n\n## Model and ModelPipeline saving and loading\n```python\nfrom PipelineTS.io import load_model, save_model\n\n# save\nsave_model(path='/path/to/save/your/fitted_model_or_pipeline.zip', model=pipeline)\n# load\npipeline = load_model('/path/to/save/your/fitted_model_or_pipeline.zip')\n\n\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "One-stop time series analysis tool, supporting time series data preprocessing, feature engineering, model training, model evaluation, model prediction, etc. Based on spinesTS and darts.",
"version": "0.3.12",
"project_urls": {
"Homepage": "https://github.com/BirchKwok/PipelineTS"
},
"split_keywords": [
"time",
"series",
"forecasting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "73933833e6cc53a80d10074ccc475bf43f7a91b51c7072e85e5a0eda288b46f6",
"md5": "5ec00c0941a83724cd552c312d33f0f8",
"sha256": "0c5fc790aaa233efa89fb42cf09ca522aac3e1f135c666b0fe2e162cebd58238"
},
"downloads": -1,
"filename": "PipelineTS-0.3.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5ec00c0941a83724cd552c312d33f0f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 118962,
"upload_time": "2024-05-13T03:49:52",
"upload_time_iso_8601": "2024-05-13T03:49:52.035575Z",
"url": "https://files.pythonhosted.org/packages/73/93/3833e6cc53a80d10074ccc475bf43f7a91b51c7072e85e5a0eda288b46f6/PipelineTS-0.3.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ca31dd3265ea9d4d1c3835ae0e05da7b1b48e1efe88326264d73b5784d7281ed",
"md5": "7dec783a35bde8794e2b0a93acfb2ec7",
"sha256": "fd5e189e2580df0d6d8adca66f1065641fb2c72a5e050faebbfea5e0d45b6f61"
},
"downloads": -1,
"filename": "pipelinets-0.3.12.tar.gz",
"has_sig": false,
"md5_digest": "7dec783a35bde8794e2b0a93acfb2ec7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 83083,
"upload_time": "2024-05-13T03:49:53",
"upload_time_iso_8601": "2024-05-13T03:49:53.999203Z",
"url": "https://files.pythonhosted.org/packages/ca/31/dd3265ea9d4d1c3835ae0e05da7b1b48e1efe88326264d73b5784d7281ed/pipelinets-0.3.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-13 03:49:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BirchKwok",
"github_project": "PipelineTS",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pipelinets"
}