Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #297 from srinivasmachiraju/master
Browse files Browse the repository at this point in the history
Added diabetes predictor project in Machine learning projects
  • Loading branch information
LordDraagonLive authored Oct 3, 2018
2 parents a988dc2 + 9faf87e commit 51171d9
Show file tree
Hide file tree
Showing 2 changed files with 796 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 22 16:44:14 2018
@author: srinivas
"""

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

dataset=pd.read_csv('diabetes.csv')
X=dataset.iloc[:,:-1].values
y=dataset.iloc[:,8].values

from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)

from sklearn.tree import DecisionTreeClassifier
classifier = DecisionTreeClassifier(criterion = 'entropy', random_state = 0)
classifier.fit(X_train, y_train)

y_pred = classifier.predict(X_test)

from sklearn.metrics import confusion_matrix
cm_decisiontree_dec = confusion_matrix(y_test, y_pred)
Loading

0 comments on commit 51171d9

Please sign in to comment.