2. Content:
Problem Defination
Various Algorithms Used in Weather Prediction
Naïve Bayes Algorithm
Explanation of Algorithm
Database
Implementation of Algorithm
Accuracy of algorithms
Future works
Conclusion
3. INTRODUCTION:
Weather forecasting is a method to predict what the
atmosphere will be like in a particular place by using
scientific knowledge to make the weather observations. In
other words, it's a way of predicting things like cloud cover,
rain, snow, wind speed and temperature before they
happen.
4. Abstract:
Weather forecasting is a method to predict what
the atmosphere will be like in a particular place by using
scientific knowledge to make the weather observations.Perfect weather
predictions are needed for daily activities and it was one of the
main challenging problem facing throughout the world because it
consists of multidimensional and nonlinear data. As per the
survey the various methods and algorithms used for weather
prediction in the field of data mining are supervised and
unsupervised machine learning algorithms, Artificial neural
network, Support Vector Machine,FP Growth Algorithm
,hadoop with map reduces , K-medoids algorithm, Naive Bayes
algorithm and decision tree classification algorithm.
6. ALGORITHM:
Bayes theorem provides a way of calculating the posterior
probability, P(c|x), from P(c), P(x), and P(x|c). Naive Bayes
classifier assume that the effect of the value of a predictor (x)
on a given class (c) is independent of the values of other
predictors. This assumption is called class conditional
independence.
7. •P(c) is the prior probability of class.
•P(x|c) is the likelihood which is the probability of predictor given class.
•P(x) is the prior probability of predictor.
•P(c|x) is the posterior probability of class (target)
given predictor (attribute).
13. DataSet Attribute Information:
Date
Temperature
Humidity
Apparent Temperature
Pressure
Wind Speed
Visibility
Daily Summary
14. Numerical to Nominal:
By using python programing we have converted this large numerical dataset to
nominal dataset.
Temperature in range
0-10c -> Cool
10-20c-> Mild
20< -> Hot
Humidity in range
0.0-0.5-> Normal
0.5< -> High
Wind Speed
0-15 -> T
15< -> F
Rain YES
NO
15. After applying the numerical to nominal dataset function
dataset appears like
16. Algorithm Implementation:
#importing the Pandas(Pandas stands for “Python Data Analysis Library”)
import pandas as pd
#pprint module provides a capability to “pretty-print” arbitrary Python data
structures in a form which can be used as input to the interpreter
import pprint
Class Classifier():
def __init__():
#read the dataset
17. def calculate_priori(self):
'''
probability(class) = How many times it appears in cloumn
__________________________________________
count of all class attribute
‘‘’
def get_cp(self, attr, attr_type, class_value):
'''
Here we calculate the individual probabilites
P(outcome|evidence) = P(Likelihood of Evidence) x Prior prob of
outcome
___________________________________________
P(Evidence)
'''
18. def calculate_conditional_probabilities(self, hypothesis):
# Here we calculate Likelihood of Evidence and multiple all individual
probabilities with priori
(Outcome|Multiple Evidence) = P(Evidence1|Outcome) x
P(Evidence2|outcome) x ... x P(EvidenceN|outcome) x P(Outcome)
scaled by P(Multiple Evidence)
def classify(self):
“
Result
yes=…
No=…
”
19. if __name__ == "__main__":
c = Classifier(filename="new_dataset.csv", class_attr="Play" )
#calling calculate priori function
c.calculate_priori()
c.hypothesis = {"Outlook":'Rainy', "Temp":"Mild", "Humidity":'Normal' , "Windy":'t’}
#calling calculate conditional probabilities function
c.calculate_conditional_probabilities(c.hypothesis)
#calling classify function
c.classify()
21. Accuracy,Precision and Recall:
To check up to what extend the obtained values are
correct we need confusion matrix.
A confusion matrix is a table that is often used to
describe the performance of a classification model (or
“classifier”) on a set of test data for which the true values
are known.
Accuracy: proportion of correct classifications(true
positives and negatives) from over all number of cases.
22. precision: Proportion of correct positive classifications (true
positives) from the predicted positive cases.
Recall: Proportion of correct positive classifications (true
positives) from the actual positive cases.
def confusionmatrix(predicted class,actual class):
#here if predicted class is 'yes' and actual class is '1',tp is
taken as tp+1.Or else if predicted class is 'yes' and actual
class is '0',fp is taken as fp+1.in the case where predicted
class is 'no' and actual class is '0',tn is taken as tn+1 else fn is
taken as fn+1.
23. def measures():
#here the accuracy, precision and recall is calculated
accuracy=(tp+tn)/(tp+tn+fp+fn)
recall=tp/(tp+fn)
precision=tp/(tp+fp)
25. SUPPORT VECTOR MACHINE (SVM):
Support Vector Machine” (SVM) is a supervised machine
learning algorithm which can be used for both classification
or regression challenges. However, it is mostly
used in classification problems.
In this algorithm, we plot each data item as a point in n-
dimensional space (where n is number of features you have)
with the value of each feature being the value of a particular
coordinate.
26. we perform classification by finding the hyper-plane
that differentiate the two classes very well (look at the
below snapshot).
28. Decision Tree:
Decision tree is in the form of a flow chart. It consists of
leaf nodes and very branch shows an outcome and every non
leaf node illustrates the test on attribute. Root node is the
topmost node in the decision tree.
The possible solutions to a given problem emerge as the
leaves of a tree, each node representing a point of
deliberation and decision
31. References:
Pushpa Mohan and Dr. Kiran KumariPatil: “Survey on Crop
and Weather Forecasting based on Agriculture related
Statistical Data”, International Journal of Innovative
Research in Computer and Communication
Engineering,Volume 5, Issue 2
Amruta A. Taksande and P. S. Mohod: “Applications of Data
Mining in Weather Forecasting Using Frequent Pattern
32. Conclusion:
Weather Predictions are essential for various applications
such as climate monitoring, drought detection, agriculture
and production, energy industry, aviation industry,
communication, pollution dispersal etc.