For a better understanding of the project, please check the Google Colab file π uploaded in this repository. It contains detailed explanations and execution steps to help you grasp the workflow more effectively.
This repository contains a machine learning model that predicts rainfall based on various weather parameters. The model is built using a Random Forest Classifier and is fine-tuned using GridSearchCV to optimize performance. π©βπ»π
- π Data preprocessing, including handling missing values and encoding categorical data
- π Exploratory Data Analysis (EDA) with visualization
- π¨ Model training and hyperparameter tuning
- β‘οΈ Downsampling to handle class imbalance
- π’ Model evaluation using accuracy, confusion matrix, and classification report
- π Prediction on new data inputs
- π Model serialization using
picklefor later use
Make sure you have the following dependencies installed:
pip install numpy pandas matplotlib seaborn scikit-learn- Clone the repository:
git clone https://github.com/yourusername/rainfall-prediction.git cd rainfall-prediction - Run the model training script:
python rainfall_prediction.py
- Load and use the saved model:
import pickle import pandas as pd with open("rainfall_prediction_model.pkl", "rb") as file: model_data = pickle.load(file) model = model_data["model"] feature_names = model_data["feature_names"] input_data = (1015.9, 19.9, 95, 81, 0.0, 40.0, 13.7) input_df = pd.DataFrame([input_data], columns=feature_names) prediction = model.predict(input_df) print("Prediction result:", "βοΈ Rainfall" if prediction[0] == 1 else "π No Rainfall")
This project is open-source and available under the MIT License. π