This repository has been archived by the owner on Oct 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from srinivasmachiraju/master
Added diabetes predictor project in Machine learning projects
- Loading branch information
Showing
2 changed files
with
796 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Machine_Learning_Projects/DIabetes_prediction/DIabetes_predictor.py
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
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) |
Oops, something went wrong.