Last active
September 25, 2019 05:11
-
-
Save Remonhasan/523fc995d1d64a41ecfd6e5066151680 to your computer and use it in GitHub Desktop.
Algorithm : Iris dataset with Naive Bayes / Research
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Remon Hasan , University of Asia Pacific | |
#Efficient process for Pycharm compiler for python | |
#Naive bayes algorithms for decting the real note of money | |
#python linear library pandas / cmd command line: pip install pandas | |
import pandas as pd | |
#python numpy library / cmd command line: pip install numpy | |
import numpy as np | |
# read the data file as csv | |
irisdata = pd.read_csv(r"C:\Users\Plab5 Pc27\Desktop\research\irish.csv") | |
# print data defined by objectirisdata | |
print(irisdata.shape) | |
print(irisdata.head()) | |
# classify the levels from the data | |
x = bankdata.drop('Variety',axis=1) | |
y = bankdata['Variety'] | |
X = bankdata.drop('Variety',axis=1) | |
# testing with 20% data for 80% data's | |
from sklearn.model_selection import train_test_split | |
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size = 0.20) | |
# python sklearn library / cmd command line: pip install sklearn | |
#python GaussianNB library / cmd command line: pip install GaussianNB | |
#using naive bayes | |
from sklearn.naive_bayes import GaussianNB | |
clf = GaussianNB() | |
clf.fit(X_train, y_train) | |
y_pred = clf.predict(X_test) | |
print(y_pred) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment