Skip to content

Instantly share code, notes, and snippets.

@Remonhasan
Last active September 25, 2019 05:12
Show Gist options
  • Save Remonhasan/6fe0327c4a6e405801fc235d36e5fff1 to your computer and use it in GitHub Desktop.
Save Remonhasan/6fe0327c4a6e405801fc235d36e5fff1 to your computer and use it in GitHub Desktop.
algorithm : Bank dataset with Naive Bayes / Research
# 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
bankdata = pd.read_csv(r"C:\Users\Plab5 Pc27\Desktop\research\note.csv")
# print data defined by object bankdata
print(bankdata.shape)
print(bankdata.head())
# classify the levels from the data
x = bankdata.drop('Class',axis=1)
y = bankdata['Class']
X = bankdata.drop('Class',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