{"id":19278241,"url":"https://github.com/tslu1s/tsforecasting","last_synced_at":"2025-04-22T00:31:44.386Z","repository":{"id":64204381,"uuid":"562522664","full_name":"TsLu1s/tsforecasting","owner":"TsLu1s","description":"TSForecasting: Automated Time Series Forecasting Framework","archived":false,"fork":false,"pushed_at":"2024-11-14T14:58:55.000Z","size":262,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T19:07:39.514Z","etag":null,"topics":["autogluon","automated-forecasting","automated-timeseries-forecasting","automl","automl-pipeline","catboost","data-science","forecasting","lightgbm","machine-learning","python","scikit-learn","timeseries","timeseries-analysis","timeseries-forecasting","xgboost"],"latest_commit_sha":null,"homepage":"","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/TsLu1s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-06T16:09:54.000Z","updated_at":"2025-01-25T09:51:01.000Z","dependencies_parsed_at":"2024-10-23T23:24:43.721Z","dependency_job_id":"46e6e86c-02bf-4203-8ca6-97a384ff386e","html_url":"https://github.com/TsLu1s/tsforecasting","commit_stats":{"total_commits":156,"total_committers":2,"mean_commits":78.0,"dds":0.07692307692307687,"last_synced_commit":"f84b780342dc879f3a7e1707f68dc4aa4558a39d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsLu1s%2Ftsforecasting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsLu1s%2Ftsforecasting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsLu1s%2Ftsforecasting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsLu1s%2Ftsforecasting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TsLu1s","download_url":"https://codeload.github.com/TsLu1s/tsforecasting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250157823,"owners_count":21384331,"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":["autogluon","automated-forecasting","automated-timeseries-forecasting","automl","automl-pipeline","catboost","data-science","forecasting","lightgbm","machine-learning","python","scikit-learn","timeseries","timeseries-analysis","timeseries-forecasting","xgboost"],"created_at":"2024-11-09T21:08:53.628Z","updated_at":"2025-04-22T00:31:44.111Z","avatar_url":"https://github.com/TsLu1s.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![LinkedIn][linkedin-shield]][linkedin-url]\n[![Contributors][contributors-shield]][contributors-url]\n[![Stargazers][stars-shield]][stars-url]\n[![MIT License][license-shield]][license-url]\n[![Downloads][downloads-shield]][downloads-url]\n[![Monthly Downloads][downloads-month-shield]][downloads-month-url]\n\n[contributors-shield]: https://img.shields.io/github/contributors/TsLu1s/TSForecasting.svg?style=for-the-badge\u0026logo=github\u0026logoColor=white\n[contributors-url]: https://github.com/TsLu1s/TSForecasting/graphs/contributors\n[stars-shield]: https://img.shields.io/github/stars/TsLu1s/TSForecasting.svg?style=for-the-badge\u0026logo=github\u0026logoColor=white\n[stars-url]: https://github.com/TsLu1s/TSForecasting/stargazers\n[license-shield]: https://img.shields.io/github/license/TsLu1s/TSForecasting.svg?style=for-the-badge\u0026logo=opensource\u0026logoColor=white\n[license-url]: https://github.com/TsLu1s/TSForecasting/blob/main/LICENSE\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\u0026logo=linkedin\u0026colorB=555\n[linkedin-url]: https://www.linkedin.com/in/luísfssantos/\n[downloads-shield]: https://static.pepy.tech/personalized-badge/tsforecasting?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=Total%20Downloads\n[downloads-url]: https://pepy.tech/project/tsforecasting\n[downloads-month-shield]: https://static.pepy.tech/personalized-badge/tsforecasting?period=month\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=Monthly%20Downloads\n[downloads-month-url]: https://pepy.tech/project/tsforecasting\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003ch2 align=\"center\"\u003e TSForecasting: Automated Time Series Forecasting Framework\n  \u003cbr\u003e\n  \n## Framework Contextualization \u003ca name = \"ta\"\u003e\u003c/a\u003e\n\nThe `TSForecasting` project offers a comprehensive and integrated pipeline designed to Automate Time Series Forecasting applications. By implementing multivariate approaches that incorporate multiple regression models, it combines varied relevant modules such as `SKLearn`, `AutoGluon`, `CatBoost` and `XGBoost`, following an `Expanding Window` structured approach for performance evaluation ensuring a robust, scalable and optimized forecasting solution.\n\nThe architecture design includes five main sections, these being: data preprocessing, feature engineering, hyperparameter optimization, forecast ensembling and forecasting method selection which are organized and customizable in a pipeline structure.\n\nThis project aims at providing the following application capabilities:\n\n* General applicability on tabular datasets: The developed forecasting procedures are applicable on any data table associated with any Time Series Forecasting scopes.\n\n* Hyperparameter optimization and customization: It provides full configuration for each model hyperparameter through the customization of `model_configurations` dictionary, allowing optimal performance to be obtained for any use case.\n    \n* Robustness and improvement of predictive results: The implementation of the TSForecasting pipeline aims to improve the predictive performance directly associated with the application of the best performing forecasting method. \n   \n#### Main Development Tools \u003ca name = \"pre1\"\u003e\u003c/a\u003e\n\nMajor frameworks used to built this project: \n\n* [Sklearn](https://scikit-learn.org/stable/)\n* [AutoGluon](https://auto.gluon.ai/stable/index.html)\n* [CatBoost](https://catboost.ai/)\n* [XGBoost](https://xgboost.readthedocs.io/en/stable/)\n* [LightGBM](https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html)\n\n    \n## Performance Evaluation Structure \u003ca name = \"ta\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.ibb.co/ctYj6tt/Expanding-Window-TSF.png\" align=\"center\" width=\"450\" height=\"350\" /\u003e\n\u003c/p\u003e  \n    \nThe Expanding Window evaluation technique is a temporary approximation on the real value of the time series data. \nThe first test segment is selected according to the train length and then it's forecasted in accordance with forecast size.\nThe starting position of the subsequent segment is set in direct relation to the sliding window size, this meaning, if the\nsliding size is equal to the forecast size, each next segment starts at the end of the previous.\nThis process is repeated until all time series data gets segmented and it uses all the iterations and observations\nto construct an aggregated and robust performance analysis to each predicted point.\n\n## Where to get it \u003ca name = \"ta\"\u003e\u003c/a\u003e\n\nBinary installer for the latest released version is available at the Python Package Index (PyPI).   \n\n## Installation  \n\nTo install this package from Pypi repository run the following command:\n\n```\npip install tsforecasting\n```\n\n# Usage Examples\n    \n## 1. TSForecasting - Automated Time Series Forecasting\n    \nThe first needed step after importing the package is to load a dataset and define your DataTime (`datetime64[ns]` type) and Target column to be predicted, then rename them to `Date` and `y`, respectively.\nThe following step is to define your future running pipeline parameters variables, these being:\n* train_size: Length of Train data in which will be applied the first Expanding Window iteration;\n* lags: The number of time steps in each window, indicating how many past observations each input sample includes;\n* horizon: Full length of test/future ahead predictions;\n* sliding_size: Length of sliding window, sliding_size\u003e=horizon is suggested;\n* models: All selected models intented to be ensembled for evaluation. To fit and compare predictive performance of available models set them in paramater `models:list`, options are the following:\n  * `RandomForest`\n  * `ExtraTrees`\n  * `GBR`\n  * `KNN`\n  * `GeneralizedLR`\n  * `XGBoost`\n  * `LightGBM`\n  * `Catboost`\n  * `AutoGluon`\n\n* hparameters: Nested dictionary in which are contained all models and specific hyperparameters configurations. Feel free to customize each model as you see fit (customization example shown bellow); \n* granularity: Valid interval of periods correlated to data -\u003e 1m,30m,1h,1d,1wk,1mo (default='1d');\n* metric: Default predictive evaluation metric is `MAE` (Mean Absolute Error), other options are `MAPE` (Mean Absolute Percentage Error) and `MSE`\n(Mean Squared Error);\n \nThe `fit_forecast` method set the default parameters for fitting and comparison of all segmented windows for each selected and configurated model. After implementation, the `history` method agregates the returning the variable `fit_performance` containing the detailed measures of each window iteration forecasted value and all segmented iterations performance.\n\nThe `forecast` method forecasts the future values based on the previously predefined best performing model.\n        \n```py\n\nfrom tsforecasting.forecasting import (TSForecasting,\n                                       model_configurations)\nimport pandas as pd\nimport warnings\nwarnings.filterwarnings(\"ignore\", category=Warning) #-\u003e For a clean console\n\n## Dataframe Loading\ndata = pd.read_csv('csv_directory_path') \ndata = data.rename(columns={'DateTime_Column': 'Date','Target_Name_Column':'y'})\ndata = data[['Date',\"y\"]]\n    \n## Get Models Hyperparameters Configurations\nparameters = model_configurations()\nprint(parameters)\n\n# Customization Hyperparameters Example\nhparameters[\"RandomForest\"][\"n_estimators\"] = 50\nhparameters[\"KNN\"][\"n_neighbors\"] = 5\nhparameters[\"Catboost\"][\"iterations\"] = 150\nhparameters[\"AutoGluon\"][\"time_limit\"] = 50\n\n## Fit Forecasting Evaluation\ntsf = TSForecasting(train_size = 0.90,\n                    lags = 10,\n                    horizon = 10,\n                    sliding_size = 30,\n                    models = ['RandomForest', 'ExtraTrees', 'GBR', 'KNN', 'GeneralizedLR',\n                              'XGBoost', 'LightGBM', 'Catboost', 'AutoGluon'],\n                    hparameters = hparameters,\n                    granularity = '1h',\n                    metric = 'MAE'\n                    )\ntsf = tsf.fit_forecast(dataset = data)\n\n# Get Fit History\nfit_performance = tsf.history()\n\n## Forecast\nforecast = tsf.forecast(dataset = data)\n\n```  \n\n## 2. TSForecasting - Extra Auxiliar Methods\n\nThe `make_timeseries` method transforms a DataFrame into a format ready for time series analysis. This transformation prepares data sets for forecasting future values based on historical data, optimizing the input for subsequent model training and analysis, taking into consideration both the recency of data and the horizon of the prediction.\n\n* window_size: Determinates how many past observations each sample in the DataFrame should include. This creates a basis for learning from historical data.\n* horizon: Defines the number of future time steps to forecast. This addition provides direct targets for prediction models.\n* granularity: Adjusts the temporal detail from minutes to months, making the method suitable for diverse time series datasets (options -\u003e 1m,30m,1h,1d,1wk,1mo).\n* datetime_engineering: When activated enriches the dataset with extra date-time features, such as year, month, and day of the week, potentialy enhancing the predictive capabilities of the model.\n \n```py   \n\nfrom tsforecasting.forecasting import Processing\n\npr = Processing()\n\ndata = pr.make_timeseries(dataset = data,\n\t\t\t  window_size = 10, \n\t\t\t  horizon = 2, \n\t\t\t  granularity = '1h',\n\t\t\t  datetime_engineering = True)\n\n```\n    \n## License\n\nDistributed under the MIT License. See [LICENSE](https://github.com/TsLu1s/TSForecasting/blob/main/LICENSE) for more information.\n\n## Contact \n \nLuis Santos - [LinkedIn](https://www.linkedin.com/in/lu%C3%ADsfssantos/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftslu1s%2Ftsforecasting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftslu1s%2Ftsforecasting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftslu1s%2Ftsforecasting/lists"}