{"id":21510558,"url":"https://github.com/elkronos/forecast_py","last_synced_at":"2025-03-17T15:20:48.453Z","repository":{"id":193602011,"uuid":"689144499","full_name":"elkronos/forecast_py","owner":"elkronos","description":"Forecasting pipeline for python","archived":false,"fork":false,"pushed_at":"2023-09-09T19:29:49.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T01:36:49.873Z","etag":null,"topics":["crossvalidation","ensemble","forecasting","python","regression","time-series"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elkronos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-08T23:20:02.000Z","updated_at":"2023-09-09T23:44:26.000Z","dependencies_parsed_at":"2023-09-09T01:26:33.614Z","dependency_job_id":null,"html_url":"https://github.com/elkronos/forecast_py","commit_stats":null,"previous_names":["elkronos/forecast_py"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkronos%2Fforecast_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkronos%2Fforecast_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkronos%2Fforecast_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elkronos%2Fforecast_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elkronos","download_url":"https://codeload.github.com/elkronos/forecast_py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056428,"owners_count":20390720,"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":["crossvalidation","ensemble","forecasting","python","regression","time-series"],"created_at":"2024-11-23T21:49:24.348Z","updated_at":"2025-03-17T15:20:48.421Z","avatar_url":"https://github.com/elkronos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forecasting Py [UNDER DEVELOPMENT]\n\nThis project consists of a series of Python scripts designed to perform time series forecasting using various statistical and machine learning models. The project is broken down into five distinct scripts, each having a unique role. Below is a summary of each script:\n\n## Script Summaries\n\n### 1. Data Preparation (data_preparation.py)\n\n#### Overview:\n- This script is responsible for generating and preparing data for modeling. It includes functions to generate a synthetic dataset with daily frequency and create various time features based on the date index.\n\n#### Usage:\n- `generate_data()`: Generates a data frame with a date range from 1/1/2020 to 1/10/2023 and a random data series.\n- `train_test_split()`: Splits the data into training and test sets with an 80-20 split.\n- `create_features()`: Creates several time series features including year, month, day, and various lag and rolling window features.\n\n#### Important Details:\n- The data is generated with a daily frequency starting from 1/1/2020 to 1/10/2023.\n- A random number generator is used to create a data series.\n- Additional features are created based on the date index to assist with time series modeling.\n\n### 2. Model Training and Prediction (model_training_and_prediction.py)\n\n#### Overview:\n- This script contains functions for training and predicting various time series models including linear regression, tree-based models, and several time series specific models like ARIMA and Prophet.\n\n#### Usage:\n- `get_best_arima_order(train_data)`: Determines the best ARIMA order for the given training data using auto_arima.\n- `train_model(model, X_train, y_train)`: Trains the specified model using the training data.\n- `predict_model(model, X_test)`: Uses the trained model to make predictions on the test data.\n- Separate functions exist for training and predicting using specific models like Prophet, ARIMA, etc.\n\n#### Important Details:\n- Includes a wide variety of models to choose from, including machine learning models and statistical time series models.\n- Model-specific training and prediction functions handle the unique requirements of each model type.\n\n\n### 3. Evaluation Metrics (evaluation_metrics.py)\n\n#### Overview:\n- This script contains functions to calculate several statistical evaluation metrics to assess the performance of the forecasting models.\n\n#### Usage:\n- `mean_absolute_percentage_error(y_true, y_pred)`: Computes the Mean Absolute Percentage Error.\n- `symmetric_mean_absolute_percentage_error(y_true, y_pred)`: Computes the Symmetric Mean Absolute Percentage Error.\n- `mean_absolute_scaled_error(y_true, y_pred)`: Computes the Mean Absolute Scaled Error.\n- `calculate_metrics(y_true, y_pred)`: Computes a series of metrics including MSE, RMSE, MAE, R2, MAPE, sMAPE, and MASE.\n\n#### Important Details:\n- The metrics are used to evaluate the model predictions compared to the actual values.\n- Additional functions compute other statistical metrics for a comprehensive evaluation of the model performance.\n\n\n### 4. Error Handler (error_handler.py)\n\n#### Overview:\n- This script contains a decorator function to catch and log errors that occur during the execution of the functions it decorates.\n\n#### Usage:\n- `error_handler(func)`: A decorator to catch any exceptions that occur during the function execution and log them to a file.\n\n#### Important Details:\n- The error handler logs errors into a file named 'errors.log'.\n- Helps in maintaining robustness by preventing the script from breaking due to errors and exceptions.\n\n\n### 5. Main Script with Stacking and Ensembling (main.py)\n\n#### Overview:\n- The main script integrates functions from all other scripts to create a complete workflow for time series forecasting. It generates data, creates features, trains models, makes predictions, and evaluates the results. Additionally, it now includes stacking and ensembling of models.\n\n#### Usage:\n- `main()`: Coordinates the entire forecasting workflow, including data generation, feature creation, model training, prediction, evaluation, and ensemble modeling.\n\n#### Important Details:\n- Utilizes the error_handler decorator to catch and log errors during the execution of the main function.\n- Trains a series of models and evaluates their performance using the metrics defined in the `evaluation_metrics.py` script.\n- Implements model stacking and ensembling by averaging predictions from individual models.\n- The results are returned as a DataFrame for easy viewing and analysis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felkronos%2Fforecast_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felkronos%2Fforecast_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felkronos%2Fforecast_py/lists"}