PipelineTS


NamePipelineTS JSON
Version 0.3.11 PyPI version JSON
download
home_pagehttps://github.com/BirchKwok/PipelineTS
SummaryOne-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_time2024-01-24 05:53:47
maintainer
docs_urlNone
authorBirch Kwok
requires_python>=3.9
license
keywords time series forecasting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1, &#x27;linear_tree&#x27;: True}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                 </td></tr>
<tr><td style="text-align: right;"> 1</td><td>multi_output_model</td><td>multi_output_model_1     </td><td>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                                      </td></tr>
<tr><td style="text-align: right;"> 2</td><td>multi_output_model</td><td>multi_output_model_2     </td><td>{&#x27;init_configs&#x27;: {&#x27;estimator&#x27;: &lt;class &#x27;xgboost.sklearn.XGBRegressor&#x27;&gt;, &#x27;random_state&#x27;: 42, &#x27;kwargs&#x27;: {&#x27;verbosity&#x27;: 0}}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}</td></tr>
<tr><td style="text-align: right;"> 3</td><td>multi_output_model</td><td>multi_output_model_3     </td><td>{&#x27;init_configs&#x27;: {&#x27;estimator&#x27;: &lt;class &#x27;catboost.core.CatBoostRegressor&#x27;&gt;, &#x27;random_state&#x27;: 42, &#x27;verbose&#x27;: False}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}       </td></tr>
<tr><td style="text-align: right;"> 4</td><td>multi_step_model  </td><td>multi_step_model_1       </td><td>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                                      </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,
    use_standard_scale=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,
    use_standard_scale=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": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "time series forecasting",
    "author": "Birch Kwok",
    "author_email": "birchkwok@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/b7/ade788e31cdb7df077fa1407eb7effa8e3bc439b9987339d5cf3fe7f5a30/PipelineTS-0.3.11.tar.gz",
    "platform": null,
    "description": "# PipelineTS\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>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1, &#x27;linear_tree&#x27;: True}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                 </td></tr>\n<tr><td style=\"text-align: right;\"> 1</td><td>multi_output_model</td><td>multi_output_model_1     </td><td>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                                      </td></tr>\n<tr><td style=\"text-align: right;\"> 2</td><td>multi_output_model</td><td>multi_output_model_2     </td><td>{&#x27;init_configs&#x27;: {&#x27;estimator&#x27;: &lt;class &#x27;xgboost.sklearn.XGBRegressor&#x27;&gt;, &#x27;random_state&#x27;: 42, &#x27;kwargs&#x27;: {&#x27;verbosity&#x27;: 0}}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}</td></tr>\n<tr><td style=\"text-align: right;\"> 3</td><td>multi_output_model</td><td>multi_output_model_3     </td><td>{&#x27;init_configs&#x27;: {&#x27;estimator&#x27;: &lt;class &#x27;catboost.core.CatBoostRegressor&#x27;&gt;, &#x27;random_state&#x27;: 42, &#x27;verbose&#x27;: False}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}       </td></tr>\n<tr><td style=\"text-align: right;\"> 4</td><td>multi_step_model  </td><td>multi_step_model_1       </td><td>{&#x27;init_configs&#x27;: {&#x27;verbose&#x27;: -1}, &#x27;fit_configs&#x27;: {}, &#x27;predict_configs&#x27;: {}}                                                                                      </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    use_standard_scale=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    use_standard_scale=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": "",
    "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.11",
    "project_urls": {
        "Homepage": "https://github.com/BirchKwok/PipelineTS"
    },
    "split_keywords": [
        "time",
        "series",
        "forecasting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2eea4649f2921d2e9b9bf9ebc23a7386d66b89f55004224a48943b04f81192c",
                "md5": "c5a1083b8d6a3a2d0d438eee67d00cac",
                "sha256": "80b1cfb03892cd7df5b1469edca2659f50420b29037a2396f33465a193e915a2"
            },
            "downloads": -1,
            "filename": "PipelineTS-0.3.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5a1083b8d6a3a2d0d438eee67d00cac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 59549,
            "upload_time": "2024-01-24T05:53:44",
            "upload_time_iso_8601": "2024-01-24T05:53:44.919164Z",
            "url": "https://files.pythonhosted.org/packages/d2/ee/a4649f2921d2e9b9bf9ebc23a7386d66b89f55004224a48943b04f81192c/PipelineTS-0.3.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bfb7ade788e31cdb7df077fa1407eb7effa8e3bc439b9987339d5cf3fe7f5a30",
                "md5": "d9ddca304f31a971e191d3fb445704c9",
                "sha256": "8e4a38d5984ffc7af86c0e37b919cd0c37a582e989ec8dbe58c2cab6081846db"
            },
            "downloads": -1,
            "filename": "PipelineTS-0.3.11.tar.gz",
            "has_sig": false,
            "md5_digest": "d9ddca304f31a971e191d3fb445704c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 40409,
            "upload_time": "2024-01-24T05:53:47",
            "upload_time_iso_8601": "2024-01-24T05:53:47.412658Z",
            "url": "https://files.pythonhosted.org/packages/bf/b7/ade788e31cdb7df077fa1407eb7effa8e3bc439b9987339d5cf3fe7f5a30/PipelineTS-0.3.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-24 05:53:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BirchKwok",
    "github_project": "PipelineTS",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pipelinets"
}
        
Elapsed time: 0.17708s