This blog contains the code for Weather prediction machine learning project using python Programming
STEP1: Installing Dependencies
*pip install pandas
*pip install sklearn
STEP2: Importing the libraries
#NaiveBayes project (Weather Prediction)
#Required Modules
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.naive_bayes import GaussianNB
STEP3:Reading the CSV
df = pd.read_csv("new_dataset.csv")
df
STEP4:Encoding the strings into numbers:
Numerics=LabelEncoder()
STEP5:Dropping the target column
inputs=df.drop('Play',axis='columns')
target=df['Play']
target
STEP6:Creating new dataframe
inputs['outlook_n']= outlook_at.fit_transform(inputs['Outlook'])
inputs['Temp_n']= outlook_at.fit_transform(inputs['Temp'])
inputs['Hum_n']= outlook_at.fit_transform(inputs['Humidity'])
inputs['win_n']= outlook_at.fit_transform(inputs['Windy'])
inputs
STEP7: Dropping the string columns
inputs_n=inputs.drop(['Outlook','Temp','Humidity','Windy'],axis='columns')
inputs_n
STEP8: Applying GaussianNB
classifier = GaussianNB()
classifier.fit(inputs_n,target)
STEP9: Prediction
classifier.predict([[0,0,0,1]])
Video explanation:
Fullcode:Github
Thanks for reading the article❤
Where is the data please?
ReplyDeleteWhere is that csv file, please upload
ReplyDeleteexplain step 3 how to import data ,can you share dataset
Deletehow to visualize the data on a graph
ReplyDeleteCan you provide a base paper for weather prediction
ReplyDeleteoutlook_at is not defined. how can we use that before defining??
ReplyDeleteIt must be 'numerics' in the place of 'outlook_at'
Delete