Introduction

In a recent project, my task was to generate weather forecast data for a Tableau dashboard aimed at helping users pinpoint ideal locations along the east coast of Australia based on their weather preferences. To kick off the project, I gathered data from six key locations along the east coast of Australia, sourced from the Australian government’s Bureau of Meteorology. This dataset spanned daily records dating back to 2015, covering various weather metrics like temperature, humidity, wind speed and direction, and solar radiation. The dashboard’s objective was to provide suggestions based on future weather conditions for these same locations over a 5-year period. To accomplish this, I employed Python along with an open-source time series tool called Prophet.

A time series model is a statistical technique used to analyze and forecast data points collected over successive time intervals. In essence, it models the relationship between a series of data points and the time at which each point was recorded. Time series models are widely used in various fields, including finance, economics, weather forecasting, signal processing, and many others.

The primary goal of a time series model is to understand the underlying structure and patterns within the data, allowing for the prediction of future values based on historical observations. These models typically incorporate components such as trend, seasonality, cyclicality, and irregular fluctuations to capture the dynamics of the data. This short video does a great job in describing what time  series analysis is.

Prophet is an open-source forecasting tool developed by Facebook’s Core Data Science team. It’s designed to handle time-series data with ease, providing a robust framework for forecasting trends, seasonality, and holidays. Here’s a brief overview of how Prophet works along with some Python code to demonstrate its usage:

  1. Data Preparation: Prophet expects input data to be in a specific format with two columns: “ds” for dates and “y” for the observed values. Optionally, it can also include additional regressors.
  2. Model Fitting: Prophet fits a generalized additive model (GAM) to the observed data. This model consists of three main components:
    • Trend: Prophet models non-periodic changes in the time series data.
    • Seasonality: It captures periodic changes like weekly, monthly, or yearly patterns.
    • Holidays: Prophet allows users to incorporate holidays and special events that might influence the time series.
  3. Forecasting: Once the model is trained, Prophet can generate future forecasts along with uncertainty intervals

Here’s a simplified example demonstrating how to use Prophet for time-series forecasting in Python:

Key Points to Note:

  • Prophet’s flexibility allows users to customize various parameters such as seasonality mode, holidays, and changepoints sensitivity.
  • The make_future_dataframe function is used to generate future dates for forecasting.
  • The predict method computes the forecast for the future dates generated.
  • Prophet provides built-in plotting functionality to visualize the forecasted data along with uncertainty intervals.

This simplified version of the code I used to create the forecast data showcases the power and user-friendliness of Prophet compared to other time series models. While I was able to produce promising forecast data, I believe the model could have yielded even better results if trained on a larger historical dataset. Fully explaining Prophet’s functionality in this short blog is challenging, but for those interested in delving deeper, I’ve shared my complete code on GitHub. Feel free to explore it for a more detailed understanding. Git Hub Link :¬†https://github.com/felixralphs/Weather-Forecasting-Prophet/blob/main/Forecast%20Loop.ipynb

Felix Ralphs
Author: Felix Ralphs