Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Prediction of Wind Speed of a Germany location near Nuremberg with location

ID in NREL – 674698

Dataset:
Dataset is used here of year 2019. The attributes are taken as follows: Year, Month, Day, Hour,
Minute, GHI, Cloud Type, Wind Speed, Precipitable Water, Wind Direction, Relative Humidity,
Temperature and Pressure. So, there is 13 attributes that would the columns of dataset and there
are 8760 rows with an hour interval.

Data Cleaning & Preprocessing :

Firstly, any column with null values is removed, then the rows with any null values are removed.
Then the Year, Month and Day column are combined to make a Date column. Column Year is
dropped as the year is same throughout the data. A column “time_idx” is made with the index of
dataframe as the series of observation time.

Wind Speed here is to be predicted for Wind forecasting.

TimeSeriesDataset:
The dataframe is needed to pass as a time series dataset in Pytorch forecasting model. The
arguments are given as follows:

 Maximum encoder length is set to be as 36 and maximum prediction length is set to be as 6.


 Data of 11 months and 15days are set to be for training.
 Target is set to be “Wind Speed” and group_ids are set to be Month and Day.
 static_reals is Pressure as it does not change over time for a particular region.
 time_varying_known-reals are "time_idx", "Month", "Day", "Hour", "Minute" as they
change over time and are continuous variable.
 time_varying_unknown_reals are "Wind Speed", "Wind Direction", "Precipitable Water",
"Relative Humidity", "GHI" because these variable is not known for future.
 Batch-side is set to be 128 and num_workers are set to be 2.

Building the model:


TemporalFusionTransforemer is used for forcasting with hidden_size 32, attention_head_size of 1,
10% dropout, hidden_continuous_size 16, loss function QuantileLoss and maximum epochs as 200.

Finding optimal learning rate:

Optimum learning rate is found by setting minimum learning rate as 1e-6 and maximum learning
rate as 30. Referring the graphs in the output the hyperparameters are tuned and learning rate is
set. Optimal learning rate can be different on every run, So, this should be ensured carefully from
the graph on each run.
Training and Loading the Model with dataset:
The dataset is fed to the model and training is done. Then the best model is loaded from checkpoint
according to the validation loss.

Evaluation and prediction:


Mean_absolute_error (MAE), Mean_squared_error (MSE) and the R2 score is evaluated.

Forecasted result is plotted and the variation of actual is visualized.

Comparison with Prophet and LSTM model:


These models perform very badly with the dataset. They give low R2 score in evaluation.

You might also like