Skip to content

Instantly share code, notes, and snippets.

View magixer's full-sized avatar
💭
magixer.cf

magixer magixer

💭
magixer.cf
  • India
View GitHub Profile
@magixer
magixer / 05-RatingClassifiers.py
Last active October 22, 2017 17:57
Rating accuracy of 6 different classifiers
from sklearn.datasets import load_wine
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
#Classifiers
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.tree import DecisionTreeClassifier
@magixer
magixer / 04-TwiceTheClassifier.py
Last active October 21, 2017 23:30
Evaluating accuracy of 2 diff classifiers from same prepared dataset
'''
Evaluating accuracy of two different classifiers - Decision Tree and GaussianNB
from same prepared dataset
'''
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import accuracy_score
from sklearn.tree import tree
@magixer
magixer / 03-AnotherDataSet.py
Created October 21, 2017 11:39
Third program
'''
Program to evaluate iris flower into its types - setosa, versicolor, virginica
using GaussianNB and rating the accuracy of the classifer
'''
from sklearn.datasets import load_iris
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
@magixer
magixer / 02-RealWorldData-Program.py
Last active October 21, 2017 10:46
First program to predict from real world data
'''
A simple program to calculate if a tumor is malignant or benign and judging our trained gaussianNB classifiers accuracy
using scikit learn module accuracy_score
'''
from sklearn.datasets import load_breast_cancer # Importing cancer dataset
from sklearn.model_selection import train_test_split # Importing train_test_split module to split our bulk data into training data and testing data
from sklearn.naive_bayes import GaussianNB # Importing classifier called 'GaussianNaiveBayes'
from sklearn.metrics import accuracy_score # Importing scikit learn module to evaluate accuracy of our classifier model
#Storing imported data into 'data'
@magixer
magixer / 01-First_Program.py
Created October 20, 2017 16:51
Beginners guide to their first machine learning program.
'''
The program predicts if a fruit is an apple or an orange from examining a
given data set of four fruits with two labels - apple or orange.
'''
import sklearn # Import SciKit Learn
from sklearn import tree # Import a classifier called 'DescisionTreeClassifier'
# Dataset of 4 fruits with 2 labels, apple and orange