-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiabetic test.py
52 lines (22 loc) · 913 Bytes
/
diabetic test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pandas as pd
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.metrics import classification_report
from sklearn.ensemble import GradientBoostingClassifier
import pickle
# warnings
import warnings
warnings.filterwarnings("ignore")
healthcare=pd.read_csv("C:/Users/manis/health care diabetes.csv")
features=healthcare.drop('Outcome',axis=1)
labels=healthcare['Outcome']
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(features, labels, test_size=0.2, random_state=10)
#GradientBoostingClassifier
gbc=GradientBoostingClassifier()
gbc.fit(X_train,y_train)
y_pred = gbc.predict(X_test)
cm=confusion_matrix(y_test,y_pred)
print(cm)
accuracy_score(y_test,y_pred)
print(classification_report(y_test,y_pred))
pickle.dump(gbc, open('diabetic.pkl', 'wb'))