Giter Club home page Giter Club logo

rainfall-prediction's Introduction

Rainfall-Prediction

Overview

This is a Flask web app which predicts whether it will rain tomorrow or not.

Dataset:

https://www.kaggle.com/jsphyg/weather-dataset-rattle-package

About the project:

Firstly, the dataset was bisected and numerical(continuous,discrete) and categorical features were identified. Missing Values were handled using Random Sample imputation to maintain the variance,Categorical Values like location, wind direction were handled by using Target guided encoding. Outliers were handled using IQR and boxplot. Feature scaling was also performed but it was not required. These are present in the ipynb file named "Data Preprocessing". Secondly, Feature Selection was done considering correlation heatmap and Extra Trees Classifier and plotting the feature importances but all the features were considered as it has only 25 features. This is present in the ipynb file named "Feature Selection". Finally, Imbalanced Dataset was handled using SMOTE. Model Creation was then performed. Different types of Machine Learning algorithms were tried like catboost, random forest, logistic regression, xgboost, support vector machines, knn, naive bayes and Decision tree. Out of these models the best classifier was selected. Catboost, random forest and Xgboost were the top 3. However, Xgboost out performed others slightly. So, the best classifier model was Xgboost. Hyperparameter Optimazation was also performedusing RandomizedSearchCV but due to system limitations a small sample out of the dataset was considered. The conclusion were made using classification metrics, roc curve and auc score.

Installation

The Code is written in Python 3.7.3 If you don't have Python installed you can find it here. If you are using a lower version of Python you can upgrade using the pip package, ensuring you have the latest version of pip. To install the required packages and libraries, run this command in the project directory after cloning the repository:

1. First create a virtual environment by using this command:
conda create -n myenv python=3.7
2. Activate the environment using the below command:
conda activate myenv
3. Then install all the packages by using the following command
pip install -r requirements.txt
4. Then, in cmd or Anaconda prompt write the following code:
python app.py
Make sure to change the directory to the root folder.

Deployement on Heroku

Login or signup in order to create virtual app. You can either connect your github profile or download Heroku CLI to manually deploy this project.

Our next step would be to follow the instruction given on Heroku Documentation to deploy a web app.

Directory Tree that is used in Model Deployment


├── templates
│   ├── home.html
    ├── rainy.html
    ├── sunny.html
├── static
    ├── predictor.css
    ├── style01.css
├── Procfile
├── README.md
├── app.py
├── Xgboost model.ipynb
├── xg_random.pkl
├── requirements.txt

The rest ipynb files are for selecting the best classifier.

Frontend Using HTML,CSS and Backend using Flask

http://rainpredsm.herokuapp.com/

Screenshot (93)

Rainy Day - Google Chrome 2021-07-28 02-20-23

Rainy Day - Google Chrome 2021-07-28 04-11-31

Technology Stack

Further Changes to be Done

  • Deploying the Web Application on Cloud.
    • Google Cloud
    • Azure
    • AWS EC2 Instance

rainfall-prediction's People

Contributors

swarnava-96 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.