LTSM-based weather prediction model for Lithuanian cities' weather
I created an autoregressive weather prediction model based on LTSM, using a dataset of the weather in Lithuania's biggest cities (Klaipėda, Kaunas & Vilnius), spanning from May 2026 to May 2016. Data is collected from OpenMateo historical's API.
The dataset is prepared by running data_process.py, which created pre-processed PyTorch tensor files with the merged dataset in data/processed/. Additionally, standardizer class states are exported to standardizer.pkl and target_standardizer.pkl. For debugging purposes, a CSV file _train.csv is exported.
Each feature column is either standardized or normalized, based on whether the values are cynical or not. Standardization uses z-scoring seperately for inputs and targets/predictions.
The model is trained using MSELoss with AdamW optimizer, scaled with mixed precision at BF16. The training is done by running train.py, my test models were trained on 8-16 epochs with a sequence length of 244-256 (sequence length is based on hourly timeframes), with the mean loss reaching 0.1-0.2, however with many spikes to and above 1, as seen in the image below.
The training produced a 15-16M parameter model, which was strong at short-term prediction with small errors (benchmarked using temperature of x_val). However, past 4-6 predictions, because of compounding errors from it's own predictions.
Evaluating and testing can be done via predict.py, which currently includes a recursive 16-step prediction loop.
This project is only intended to be used for learning & educational purposes, neither the model nor architecture is accurate enough to predict real-world weather.
pytorch, numpy, pandas
