Logo Lanfrica

WilliamGichora/rainfall_RNN_lstm_project

Domaine:

climate

Type de record:

project
Créateur:
Wil
Hôte:
TensorFlow + LSTM for Kenya Rainfall Anomaly Forecasting # Kenya Rainfall Forecasting and Anomaly Classification This project uses recurrent neural networks, specifically Long Short-Term Memory (LSTM) models, to analyze monthly rainfall patterns in Kenya from 1991 to 2016. It was built as a neural networks assignment and is structured as a small, reproducible machine learning workflow rather than a single model-training script. The project includes two related tasks: - Forecasting next-month rainfall amount from the previous 12 months of rainfall history. - Classifying next-month rainfall as below-normal, normal, or above-normal using anomaly thresholds derived from the training period. ## Project Highlights - Cleaned and transformed raw year/month rainfall records into a chronological monthly time series. - Converted the time series into 12-month sliding windows for LSTM training. - Engineered rainfall and seasonality features including rolling rainfall averages, anomaly z-scores, rainfall ratios, first-order rainfall change, and cyclic month encodings. - Used chronological train, validation, and test splits so future observations do not leak into model training. - Added baseline classifiers such as majority class, previous-month persistence, and target-month majority to judge whether the LSTM adds value. - Evaluated classification with accuracy, balanced accuracy, macro F1, confusion matrices, and per-class precision/recall rather than relying on accuracy alone. ## Repository Structure ```text rainfall_RNN_lstm_project/ |-- data/ | `-- kenya-climate-data-1991-2016-rainfallmm.csv |-- notebooks/ | |-- Rainfall_Prediction_RNN.ipynb | `-- kenya_rainfall_lstm.ipynb |-- .gitignore |-- README.md `-- requirements.txt ``` ## Notebooks ### `notebooks/Rainfall_Prediction_RNN.ipynb` Builds a rainfall regression model. It scales monthly rainfall values, creates 12-month input windows, trains an LSTM model, and predicts the next month's rainfall amount. Saved result: - Test RMSE: approximately `32.04 mm` ### `noteb …