The core goal is to determine whether it will rain or not (Yes/No). Logistic Regression is used because it is a binary classifier, making it suitable for this type of problem.
In this Rainfall Prediction project, we use three main weather factors: Precipitation (amount of rain), temperature (both highest and lowest of the day), and wind speed. Using this data, we train a Logistic Regression model to predict if it will rain or not. The aim is to help people, like farmers or event planners, make better decisions based on whether it's likely to rain.
- Pandas and NumPy: For data manipulation and analysis.
- Scikit-Learn: For building the Logistic Regression model and saving it as rfp.pkl.
- Pickle: For saving and loading the trained model.
Django Framework: To create the web application and integrate the machine learning model. HTML/CSS: For designing the front-end of the web page where users input data.
- Acquire the dataset
- Import all the crucial libraries
- Import the dataset
- Extract the independent variables
- Extract the dependent variable
- Identifying and handling the missing values
- Encoding the categorical data
- Splitting the dataset
- A Confusion Matrix is created which summarizes the performance of the model on a set of test data. It offers a thorough analysis of the model’s Accuracy.
- Now we dump the file using pickle (a python module), so that we create a model and a new file is created with the extension .pkl
-
First install Django Framework : pip install Django
-
Create a Django Project and App: django-admin startproject myproject cd myproject python manage.py startapp myapp
-
Load the Model in Django Views: Load your model in the Django app views.
-
Set Up URL Configuration:- Add a URL pattern for the prediction view.
-
Create a Template : Create a simple form template for input and displaying results.
-
Create an External CSS File: Create a new file named style.css in your app's static folder: Directory Structure: myapp/ ├── static/ │ └── myapp/ │ └── style.css └── templates/ └── predict.html
In your predict.html file, link the external CSS:
{% load static %}
- Configure Django to Use Static Files :
Ensure your Django settings allow static files by adding the following in
settings.py:
import os STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'myapp/static’)]
- Run the Django Server: python manage.py runserver
Visit http://127.0.0.1:8000 to make predictions using the integrated model.
- Agriculture
- Disaster Management
- Water Resource Management
- Tourism and Outdoor Events
1. First open cmd .
2. Then select Project Directory using cd
3. For run the project use command :python manage.py runserver
4. Then we open chrome and run : localhost:8000