weather forecasting krish project
weather forecasting krish project
REPORT ON
“WEATHER FORECASTING’’
This dissertation Submitted in partial fulfillment of the requirement For the award of the
degree of
BACHELOR OF TECHNOLOGY
IN
Submitted By
B.Krishna 22C71A0526
K.DurgaTeja 22C71A0504
P.Harika 22C71A0546
DR.S.SWATHI RAO
( ASSOCIATE PROFESSOR)
(ASST PROFESSOR)
i
PATELGUDA,AMEENPUR,SANGAREDDY DISTRICT-502319 Affiliated
to JNTU,Hyderabad
This is certify that dissertation entitled "weather forecasting "being submitted by Bandaru
krishna ,K. durga teja & P.Harika bearing Roll no.22C71A0526,22C71A0504,22C71A0546
in partial fulfillment of the requirements of the award of degree of BACHELOR OF
TECNOLOGY in COMPUTER SCIENCE AND ENGINEERING ,under JAWAHARLAL
NEHRU TECHNOLOGICAL UNIVERCITY ,is a record of bonafide work carried out by
them under by guidance and supervision . The results embodied by in this real time
research project report have not been submitted to any other university or institute for the
award of any degree .
Dr.JOHN PAUL
ii
(Professor)
ACKNOWLEDGEMENT
We would like to thank Sri E. SADASHIVA REDDY, Chairman, Ellenki Group of
Institutions for providing us the conducive environment for carrying through
my academic schedules and Real time research Projects with ease.We
express a wholehearted gratitude to Mr. M. SAMBHA SHIVA REDDY, Director,
Ellenki Group of Institutions and Director of Research and Development
Centre, Ellenki college Of Engineering and Technology, for providing us the
conducive environment for carrying through my academic schedules and real
time research projects with ease.We would like to thank our Principal Dr. P.
JOHN PAUL, Ellenki College of Engineering and Technology. His insight during
the real time project and regular guidance were valuable to me and also for
providing right suggestions at every phase of the development of my real
time research project.We would like to thank our esteemed secretary Sri
E.Dayakar Reddy and Academic Director Sri E.Sai Kiran Reddy for their
invaluable supervision, support and guidance throughout our study in
college.
Our sincere thanks to all our faculty members for their guidance and support
throughout our study at college and we also thank all our administrative
staff, examination branch staff for timely responding to our queries.We
would like to thank all the staff members of the Research and Development
Centre and Department of Computer Science And Engineering.
There is definitely a need to thank my friends and parents for their patience
and support in always leading to successful completion of the real time
project.
ii
i
B.Krishna
22C71A0526
K.Durga teja
22C71A0504
P.Harika
22C71A0546
TABLE OF CONTENTS
CHAPTERS PAGE NO
ABSTRACT 1
CHAPTER 1: INTRODUCTION 2
1.1 INTRODUCTION 2
1.2 PROBLEM DEFINITION 2
1.3 SCOPE 3
1.4 PURPOSE 3
1.5 PROBLEM AND EXISTING 4
TECHNOLOGY
1.6 PROPOSED SYSTEM 4
3.1 ALGORITHMS 12
3.2 PSEUDO CODE 12
CHAPTER 4: SCREENSHOTS 19
CHAPTER 5: CONCLUSION 21
CHAPTER 6: REFERENCES 22
i
v
v
ABSTRACT
Page 1
1.INTRODUCTION
Data Warehousing
Data Mining
Data mining is looking for hidden, valid, and potentially useful patterns in
huge data sets. Data Mining is all about discovering unsuspected/ previously
unknown relationships amongst the data.It is a multi-disciplinary skill that uses
machine learning, statistics, AI and database technology.
1.1. Introduction
In this project, we used Linear Regression to predict the amount of rainfall. Linear
Regression tells us how many inches of rainfall we can expect.
It is important to exactly determine the rainfall for effective use of water resources,
crop productivity and pre- planning of water structures.
Page 2
1.3 Scope
It tells us how many inches of rainfall we can expect.
1.4 Purpose
There are several reasons why weather forecasts are important. They would
certainly be missed if they were not there. It is a product of science that impacts the
lives of many people. The following is a list of various reasons why weather
forecasts are important:
1. Helps people prepare for how to dress (i.e. warm weather, cold weather, windy
weather, rainy weather)
2. Helps businesses and people plan for power production and how much power to
use (i.e. power companies, where to set thermostat)
3. Helps people prepare if they need to take extra gear to prepare for the weather
(i.e. umbrella, rain coat, sun screen)
4. Helps people plan outdoor activities (i.e. to see if rain/storms/cold weather will
impact outdoor event)
5. Helps curious people to know what sort of weather can be expected (i.e. a snow
on the way, severe storms)
6. Helps businesses plan for transportation hazards that can result from the weather
(i.e. fog, snow, ice, storms, clouds as it relates to driving and flying for example)
7. Helps people with health related issues to plan the day (i.e. allergies, asthma,
heat stress)
8. Helps businesses and people plan for severe weather and other weather hazards
(lightning, hail, tornadoes, hurricanes, ice storms)
9. Helps farmers and gardeners plan for crop irrigation and protection (irrigation
scheduling, freeze protection)
Page 3
1.5 Problem and Existing Technology
User will enter current temperature; humidity and wind, System will take this
parameter and will predict weather from previous data in database. The role of the
admin is to add previous weather data in database, so that system will calculate
weather based on these data. Weather forecasting system takes parameters such as
Page 4
temperature, humidity, and wind and will forecast weather based on previous
record therefore this prediction will prove reliable.
2.REQUIREMENTS
Hardwar
e/ Hardware / Software element Specification /version
Software
Hardwar Processor i3
e RAM 2GB
Software OS Windows,Linux.
Python 3.
Page 5
2) Applying Algorithm for prediction .
Explanation:
1) In this module we first gather the data(dataset) for our prediction model.Data
comes in all forms, most of it being very messy and unstructured. They rarely
come ready to use. Datasets, large and small, come with a variety of issues- invalid
fields, missing and additional values, and values that are in forms different from
the one we require. In order to bring it to workable or structured form, we need to
“clean” our data, and make it ready to use. Some common cleaning includes
parsing, converting to one-hot, removing unnecessary data, etc.
In our case, our data has some days where some factors weren’t recorded. And the
rainfall in cm was marked as T if there was trace precipitation. Our algorithm
requires numbers, so we can’t work with alphabets popping up in our data. so we
need to clean the data before applying it on our model.
2)Once the data is cleaned, In this module that cleaned data can be used as an input
to our Linear regression model. Linear regression is a linear approach to form a
relationship between a dependent variable and many independent explanatory
variables. This is done by plotting a line that fits our scatter plot the best, ie, with
the least errors. This gives value predictions, ie, how much, by substituting the
independent values in the line equation.
We will use Scikit-learn’s linear regression model to train our dataset. Once the
model is trained, we can give our own inputs for the various columns such as
temperature, dew point, pressure, etc. to predict the weather based on these
attributes.
Module Outcomes:
Page 6
1) By the end of the first module the fully cleaned and useful data is available for
the apply the algorithm for the prediction.
1) By the end of the second module the actual prediction will be happen the
outcome is the amount of rainfall in inches based upon the users input.
Algorithm:
Linear Regression is a machine learning algorithm based on supervised learning. It
performs a regression task. Regression models a target prediction value based on
independent variables. It is mostly used for finding out the relationship between
variables and forecasting. Different regression models differ based on – the kind of
relationship between dependent and independent variables, they are consideringand
the number of independent variables being used.
Page 7
Linear regression performs the task to predict a dependent variable value (y) based
on a given independent variable (x). So, this regression technique finds out a linear
relationship between x (input) and y(output). Hence, the name is Linear
Regression.
In the figure above, X (input) is the work experience and Y (output) is the salary of
a person. The regression line is the best fit line for our model.
Where
The dataset is a public weather dataset from Austin, Texas available on Kaggle.
austin_weather.csv
Columns:
Date-
TempHighF-
TempAvgF-
Page 8
Average temperature, in degrees Fahrenheit
TempLowF-
DewPointHighF-
DewPointAvgF-
DewPointLowF-
HumidityHighPercent-
HumidityAvgPercent-
HumidityLowPercent-
SeaLevelPressureHighInches-
SeaLevelPressureAvgInches-
SeaLevelPressureLowInches-
Page 9
Low sea level pressure, in inches of mercury
VisibilityHighMiles-
VisibilityAvgMiles-
VisibilityLowMiles-
WindHighMPH-
WindAvgMPH-
WindGustMPH-
PrecipitationSumInches-
Events-
Page
10
3.DESIGN AND IMPLEMENTATION
3.1 Algorithms:
Linear Regression:
Module-1 :Data gathering and pre - processing.
Page
11
# read the data in a pandas dataframe
data = pd.read_csv("C:/Users/TEMP.SANDEEP/Desktop/austin_weather.csv")
Page
12
# the above data array
df = pd.DataFrame(data)
# show plot
plt.show()
#basic static
# importing libraries
import pandas as pd
import numpy as np
import sklearn as sk
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
Page
13
# will serve as the label
X = data.drop(['PrecipitationSumInches'], axis = 1)
Page
14
# print the output.
print('The precipitation in inches for the input is:', clf.predict(inp))
plt.show()
x_vis = X.filter(['TempAvgF', 'DewPointAvgF', 'HumidityAvgPercent',
'SeaLevelPressureAvgInches', 'VisibilityAvgMiles',
'WindAvgMPH'], axis = 1)
Page
15
print("Precipitation vs selected attributes graph: ")
for i in range(x_vis.columns.size):
plt.subplot(3, 2, i + 1)
plt.scatter(days, x_vis[x_vis.columns.values[i][:100]],
color = 'g')
plt.scatter(days[day_index],
x_vis[x_vis.columns.values[i]][day_index],
color ='r')
plt.title(x_vis.columns.values[i])
plt.show()
OUTPUT:
Page
16
2)The precipitation trend graph:
Page
17
A day (in red) having precipitation of about 2 inches is tracked across multiple
parameters (the same day is tracker across multiple features such as temperature,
pressure, etc). The x-axis denotes the days and the y-axis denotes the magnitude of
the feature such as temperature, pressure, etc. From the graph, it can be observed
that rainfall can be expected to be high when the temperature is high and humidity
is high.
Page
18
4. SCREENSHOTS
Page
19
5.CONCLUSION
We successfully predicted the rainfall using the linear regression but here this is
not very accurate only some times any way it depends upon the climate changes to
season to season.Here we are taking only summer season weather data set it only
useful to predict rainfall in summer season.
weather and climate represent different aspects of Earth's
atmospheric conditions. Weather refers to short-term, immediate
atmospheric phenomena, while climate represents long-term
average weather
Page
20
6.REFERENCES
Textbooks:-
2. Data Mining: Concepts and TechniquesBy Jiawei Han, Jian Pei, Micheline
Kamber.
Weblinks:-
Page
21
1) https://towardsdatascience.com/introduction-to-machine-learning-
algorithms-linear-regression-14c4e325882a
2) https://www.kaggle.com/grubenm/austin-weather
Page
22