Skip to content

GabrielNyamu/Rainfall-Predictive-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Nairobi Rainfall Predictive Classifier 🌦️

πŸ“Œ Project Overview

This project is a Machine Learning solution engineered to predict rainfall in Nairobi, Kenya. It analyzes historical weather patterns to determine whether it will rain on a given day.

The model was built using Python and Scikit-Learn, leveraging weather data collected specifically for the Nairobi region from March 2024 to March 2025.

πŸš€ Key Features

  • Custom Classification Logic: Implemented Linear Regression with a custom decision boundary (threshold of 0.5) to convert continuous regression outputs into binary classification (Rain / No Rain).
  • Feature Engineering: Processed key meteorological indicators including temperature, precipitation probability, wind speed, and humidity.
  • High Accuracy: The model achieved a 90% accuracy rate on the test dataset.

πŸ› οΈ Tech Stack

  • Language: Python 3.x
  • Libraries: Scikit-Learn, Pandas, NumPy
  • Data Processing: Custom preprocessing pipeline for continuous weather data.

πŸ“Š Dataset & Methodology

Data Source

The dataset consists of daily weather observations for Nairobi, Kenya, spanning a full annual cycle (March 2024 - March 2025).

Model Architecture

Instead of using standard logistic regression, this project explores the utility of Linear Regression for classification tasks:

  1. Input: Continuous variables (Temperature, Wind Speed, Humidity, Precipitation Prob).
  2. Processing: Linear equation fitting.
  3. Output Transformation: A threshold logic is applied where:
    • $y < 0.5 \rightarrow$ No Rain (0)
    • $y \geq 0.5 \rightarrow$ Rain (1)

πŸ“ˆ Performance

  • Accuracy: 90%
  • Context: The model successfully identified rain patterns during the distinct Nairobi rainy seasons within the dataset timeframe.

πŸ’» How to Run

  1. Clone the repository:
    git clone [https://github.com/gabrielnganga/Nairobi-Rainfall-Predictive-Classifier.git](https://github.com/gabrielnganga/Nairobi-Rainfall-Predictive-Classifier.git)
  2. Install dependencies:
    pip install pandas scikit-learn numpy
  3. Run the predictor:
    python main.py

πŸ‘€ Author

Gabriel Ng'ang'a

About

A machine learning project that uses Linear Regression to predict whether it will rain or not based on weather data such as temperature, humidity, pressure, and wind speed. Built with Python, pandas, and scikit-learn.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors