Follow us on Twitter!
Don't judge the unknown - Grindordie
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 29
Guests Online: 24
Members Online: 5

Registered Members: 82895
Newest Member: kevy90
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Naive-Bayes weather predictions in python


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-03-11 16:24
I need some help in creating a weather prediction system using Naive-Bayes in python.
What it will do is take in a file which contains weather data such as temperature (mean, max, min), wind, dew point, humidity, condition (fog, rain, snow, none) etc. and use this to train a naive Bayesian model so it can then predict the condition of the next day, i.e will the next day be fog, rain, snow or none.There are two .csv files which contain the data for training and testing(also named the same).I have the code handles the input of the data file, I just need to create the classifier but I am not sure how to do it.My program must take data in training.csv and train a Naive Bayes model that takes
the following as inputs:
1. Mean temperature
2. Maximum temperature
3. Minimum temperature
4. The dew point
5. Average humidity
6. Maximum humidity
7. Minimum humidity
8. Sea Level Pressure
9. Wind speed
10. Maximum wind speed
11. Maximum gust speed
12. Visibility
This is what I've written so far:

Code
import WeatherData as wd
import Evaluation
import sys
import string


####################### Main Program #########################

# Checks if it has 2 .csv files as the input
if len(sys.argv) != 3:
    sys.exit("Incorrect amount of arugements")

trainFileName = string.split(sys.argv[1], '.')
testFileName = string.split(sys.argv[2], '.')

if (trainFileName[len(trainFileName) -1] != "csv") or (testFileName[len(testFileName) - 1] != "csv"):
    sys.exit("Incorrect file type");


# Handles input
trainingData = wd.WeatherData(sys.argv[1])
testingData = wd.WeatherData(sys.argv[2])


### my training goes here


### my prediction generation goes here, prediction is a list of strings
predictions = []
####################
# this is dummy code to generate predictions I will delete it in my final version
for day in testingData.getMeasurements():
    predictions.append(day.condition)
####################




Edited by on 21-03-11 18:38
Author

RE: Naive-Bayes weather predictions in python

GTADarkDude
Member



Posts: 142
Location: The Netherlands
Joined: 23.02.08
Rank:
Newbie
Posted on 21-03-11 22:05
You're "not sure how to do it." Ok... right. Well, what do you want us to do, then? Should we give you a full implementation of a naive Bayesian classifier in Python? Because those can be found here: http://bit.ly/h7tOjf
Or do you want us to explain what the classifier does? Because an explanation can be found here: http://bit.ly/7OIMj

Either do your own homework, or ask specific questions, please.


...
- - -
Author

RE: Naive-Bayes weather predictions in python


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-03-11 22:23
How can I implement the naive bayse classifier to achieve a weather prediction system?I do not now where to start so I'm looking for some guidance because I want to understand how to create the program...
The links you provided above don't work
Author

RE: Naive-Bayes weather predictions in python


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 21-03-11 22:47
I found something about this...
http://orange.biolab.si/doc/ofb/c_pythonlearner.htm
Maybe I cant assimilate some useful knowledge from it

Edited by on 21-03-11 22:47
Author

RE: Naive-Bayes weather predictions in python


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 22-03-11 15:35
You didn't write this code. All it does is read in data from the two CSV files and creates two WeatherData instances for both the training and testing data which you will use.

Have a look at WeatherData.py and DayWeatherMeasurements.py to see how these classes work as you will have to use them in the training and testing of the classifier.

I recommend reading the notes here:

http://www.inf.ed.ac.uk/teaching/courses/inf2b/learnnotes/inf2b11-notes.pdf

Chapters 5 and 6 explain naive Bayes but since the weather data is continuous you will need to model it as a Gaussian (normal) distribution which is explained in chapters 8 and 9.
Author

RE: Naive-Bayes weather predictions in python

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 23-03-11 15:01
Do your own homework, fuck off.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce