An open API service indexing awesome lists of open source software.

https://github.com/laura-projects-work/weather-forecasting

Weather forecasting using time series data in R.
https://github.com/laura-projects-work/weather-forecasting

machine-learning python r time-series-forecasting weather-forecasting

Last synced: 8 months ago
JSON representation

Weather forecasting using time series data in R.

Awesome Lists containing this project

README

          

# Weather Forecasting (Time Series)

This repository contains a framework for weather forecasting using time series data. The project integrates data preprocessing, modeling techniques, performance evaluation, and result visualization.

---

## Project Structure
```bash
project/
├── data/
│ ├── hourly_data.csv # Dataset
│ └── get_data.ipynb # Notebook for data retrieval
├── src/
│ ├── utilities.R # General helper functions
│ ├── data_preprocessing.R # Functions for loading and preprocessing data
│ ├── metrics.R # Function to compute performance metrics
│ ├── modeling.R # All modeling functions (XGBoost, GLMNET, Cubist, ARIMA, Prophet)
│ └── results_visualization.R # Functions for visualizing forecasts and evaluation results
├── main.R # Main workflow script that ties everything together
└── README.md # Project documentation
```

---

## Features

- **Data Preprocessing**
- Load data.
- Remove predictors highly correlated with the target.
- Add Fourier-based time features to capture periodic patterns.

- **Modeling Functions**
- **XGBoost:** Regression using gradient boosting.
- **GLMNET:** Penalized regression.
- **Cubist:** Rule-based regression.
- **ARIMA:** Univariate time series forecasting.
- **Prophet:** Forecasting using Facebook's Prophet.

- **Performance Evaluation**
- Compute RMSE, R-squared, and adjusted R-squared.

- **Utility Functions**
- `time_it()`: Measure the execution time of any function.
- `format_forecast()`: Standardize the output of model forecasts.

---

## Requirements

- **R** (version ≥ 3.5 recommended)
- Required R packages:
- `data.table`
- `ggplot2`
- `lubridate`
- `caret`
- `xgboost`
- `Metrics`
- `forecast`
- `prophet`
- *(Optional for parallel processing)* `doParallel`, `foreach`

---

## Installation and Setup
1. Clone the project repository to your local machine:
```bash
git clone https://github.com/laura-projects-work/weather-forecasting.git
cd weather-forecasting
```

2. Install Required R Packages
```bash
install.packages(c("data.table", "ggplot2", "lubridate", "caret", "xgboost", "Metrics", "forecast", "prophet"))
# For optional parallel processing support:
install.packages(c("doParallel", "foreach"))
```

3. Ensure that the dataset (hourly_data.csv) is in the data/directory. Alternatively, run the get_data.ipynb notebook to retrieve and prepare the data.