A deep learning tensorflow project that predicts rainfall occurrence (rain / no rain) using atmospheric and environmental parameters such as temperature, humidity, wind speed, pressure, UV index, cloud cover, and more.
This repository contains a complete pipeline from preprocessing, model training, evaluation, to metric visualization.
- Full preprocessing workflow with a JSON-based numerization dictionary
- Scalable TensorFlow model architecture
- Binary classification (Rain vs No Rain)
- Performance evaluation:
- Confusion Matrix
- Precision, Recall, F1-Score
- ROC Curve + AUC
- Modular Python scripts (
TrainModel.py,EvaluateModel.py) - Clean and reproducible experiment setup
The dataset used in this project was obtained from Kaggle.
It contains weather observations with the following relevant features:
- Temperature
- Humidity
- Wind Speed
- Precipitation
- Cloud Cover
- Pressure
- UV Index
- Season
- Visibility
- Location
- Rain (label: 0 = No Rain, 1 = Rain)
Missing categorical entries are handled through dictionary-based mapping stored in numerization_dict.json.
Run the training script:
python TrainModel.pyThis will:
- Load and preprocess the dataset
- Scale numerical features
- Train a binary classifier
- Save the trained model
- Print final loss and accuracy
Example training output:
Model Loss: 0.1070
Model Accuracy: 0.9584
Evaluate the model on the test set:
python EvaluateModel.pyThis script generates:
- Confusion Matrix
[[9656 244]
[ 329 2971]]
- Precision: 0.9241
- Recall: 0.9003
- F1-Score: 0.9120
- ROC Curve + AUC (example: 0.990)
The model uses a feed-forward neural network with:
- Dense layers
- Mish and swish activations
- Binary crossentropy loss
- Adamax optimizer
Optimized for binary weather classification tasks.
Categorical features (e.g., Cloud Cover, Season, Location) are converted into numeric form using a mapping loaded from numerization_dict.json.
This ensures consistent preprocessing and reproducible results.
| Metric | Value |
|---|---|
| Accuracy | 0.9584 |
| Precision | 0.9241 |
| Recall | 0.9003 |
| F1-Score | 0.9120 |
| AUC | 0.990 |
The model demonstrates high performance and strong discriminatory power.
Potential enhancements:
- Add more meteorological features (dew point, wind direction, solar radiation)
- Time-series forecasting using LSTM/GRU
- Deployment through a Flask or FastAPI service
- Interactive dashboard for predictions
- Automatic hyperparameter tuning (Keras Tuner, Optuna)
This project is licensed under the MIT License.
