Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 3.35 KB

File metadata and controls

30 lines (26 loc) · 3.35 KB

OWF TSTool AI Plugin Documentation

Background | Defining the Problem Domain | Reviewing and Processing the Input Data | Configuring the Model | Evaluating the Model | Using the Model

Background

The OWF TSTool AI Plugin is designed to implement Time series forecasting for Water levels using a Custom DeepAR LSTM model. The goal is to predict future water levels and streamflow for flood warnings and to provide insights into water level trends without the need for traditional modeling of a mathematical and physical model. Future and historical weather data is obtained using the open-meteo.com/ API. TSTool is used to get the historical water level data from the database. The Python programming language and the PyTorch library are used for model training and data preprocessing. The plugin is written in Java and the model is deployed using DJL (Deep Java Library).

Defining the Problem Domain

The problem domain is to predict future water levels based on historical data and current weather conditions. For this to work, the correct time series data are needed for each location. The procedure is as follows:

  1. Select a water level station that is of interest using TSTool.
  2. Get the historical water level data for that station using TSTool for a as long time period as possible.
  3. Use the open-meteo.com/ API to get the historical weather data for the same time period as the water level data.
  4. Preprocess the data to make everything in the same hourly time steps and fill any missing values and transforming the data into time periods usable for the model so 30 days of historical data and 7 days of future weather data.
  5. Use the preprocessed data to train the model.
  6. Once the model is trained, it can be used to predict future water levels based on current and historical weather data and historical water levels.

Reviewing and processing the input data

The input data is both in the json format and needs to be preprocessed to have a regular hourly time step and to convert the data into .npy a format used by numpy and PyTorch to store the data as binary files for efficient loading.

Configuring the model

In the Moment the model uses both 30 days of historical water and weather data and 7 days of future weather data to predict the next 7 days of water levels this is one forecasting step for the model. The model is a custom DeepAR LSTM model that is trained on the preprocessed data. Other parameters that can be configured are the number of epochs(one full pass through of the dataset), the batch size(number of training samples the model processes before updating the weights), and the learning rate(how much the model's weights are updated during training). These parameters can be adjusted to improve the model's performance.

Evaluating the Model

The model can be evaluated using various metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE). These metrics can be calculated using the predictions made by the model on a test dataset that was not used during training. (We split the data into 80/20 split for training and testing.)

Using the Model

The model can be used using the OWF TSTool AI Plugin. Which is written in Java und uses the DJL (Deep Java Library).