-
Notifications
You must be signed in to change notification settings - Fork 0
/
prediction_pipeline.py
82 lines (45 loc) · 1.77 KB
/
prediction_pipeline.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import pickle
import joblib
import numpy as np
from sklearn.preprocessing import StandardScaler
# Diabetes prediction
def diabetes_prediction(data):
with open("src/Diabetes-Detection/scaler.pkl", "rb") as f:
scaler = pickle.load(f)
data = np.array(data).reshape(1,-1)
scaled_data = scaler.transform(data)
with open("src/Diabetes-Detection/model.pkl", "rb") as f:
model = pickle.load(f)
pred = model.predict(scaled_data)
return pred
# new_data = np.array([6,148,72,35,0,33.6,0.627,50]).reshape(1, -1)
# pred = diabetes_prediction(new_data)
# if pred==1:
# print("The patient has diabetes")
#breast cancer prediction
def breast_cancer_prediction(data):
with open("src/Breast-Cancer/scaler.pkl", "rb") as f:
scaler = pickle.load(f)
data = np.array(data).reshape(1,-1)
scaled_data = scaler.transform(data)
with open("src/Breast-Cancer/model.pkl", "rb") as f:
model = pickle.load(f)
pred = model.predict(scaled_data)
return pred
# new_data = np.array([17.99, 1001.0, 0.262779, 0.3001, 0.14710, 2019.0, 0.665600, 0.7119, 153.40, 0.006193, 0.460100, 0.11890]).reshape(1, -1)
# pred = breast_cancer_prediction(new_data)
# if pred==1:
# print("The patient has Breast cancer")
# else:
# print("The patient does not have Breast cancer")
def heart_disease_prediction(data):
with open("src/Heart-Disease/scaler.pkl", "rb") as f:
scaler = pickle.load(f)
data = np.array(data).reshape(1,-1)
scaled_data = scaler.transform(data)
with open("src/Heart-Disease/heart_model.pkl", "rb") as f:
model = pickle.load(f)
pred = model.predict(scaled_data)
return pred
def malaria_detection():
pass