-
Notifications
You must be signed in to change notification settings - Fork 31
/
data_provider.py
71 lines (53 loc) · 2.47 KB
/
data_provider.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
import os
import pickle
import joblib
config = {
'Kidney': {
'SVC': 'production/svc_model.pkl',
'LogisticRegression': 'production/Logistic_regression_model.pkl',
'NaiveBayes': 'production/naive_bayes_model.pkl',
'DecisionTree':'production/decision_tree_model.pkl',
'NN':'production/NN_model.pkl',
'KNN':'production/KNN_model.pkl',
'scalar_file_decision': 'production/standard_scalar_decision.pkl',
'scalar_file_logistic': 'production/standard_scalar_logistic.pkl',
'scalar_file_naive': 'production/standard_scalar_naive.pkl',
'scalar_file_svc': 'production/standard_scalar_svc.pkl',
'scalar_file_NN': 'production/standard_scalar_NN.pkl',
'scalar_file_KNN': 'production/standard_scalar_KNN.pkl',
}}
dir = os.getcwd()+'/predict_risk_1/'
def GetJobLibFile(filepath):
if os.path.isfile(os.path.join(dir, filepath)):
return joblib.load(os.path.join(dir, filepath))
return None
def GetPickleFile(filepath):
if os.path.isfile(os.path.join(dir, filepath)):
return joblib.load(os.path.join(dir, filepath))
return None
def GetStandardScalarForD():
return GetPickleFile(config['Kidney']['scalar_file_decision'])
def GetStandardScalarForL():
return GetPickleFile(config['Kidney']['scalar_file_logistic'])
def GetStandardScalarForN():
return GetPickleFile(config['Kidney']['scalar_file_naive'])
def GetStandardScalarForS():
return GetPickleFile(config['Kidney']['scalar_file_svc'])
def GetStandardScalarForNN():
return GetPickleFile(config['Kidney']['scalar_file_NN'])
def GetStandardScalarForKNN():
return GetPickleFile(config['Kidney']['scalar_file_KNN'])
def GetAllClassifiersForKidney():
return (GetSVCClassifierForKidney(),GetLogisticRegressionClassifierForKidney(),GetNaiveBayesClassifierForKidney(),GetDecisionTreeClassifierForKidney(),GetNNClassifierForKidney(),GetKNNForKidney())
def GetSVCClassifierForKidney():
return GetJobLibFile(config['Kidney']['SVC'])
def GetLogisticRegressionClassifierForKidney():
return GetJobLibFile(config['Kidney']['LogisticRegression'])
def GetNaiveBayesClassifierForKidney():
return GetJobLibFile(config['Kidney']['NaiveBayes'])
def GetDecisionTreeClassifierForKidney():
return GetJobLibFile(config['Kidney']['DecisionTree'])
def GetNNClassifierForKidney():
return GetJobLibFile(config['Kidney']['DecisionTree'])
def GetKNNForKidney():
return GetJobLibFile(config['Kidney']['DecisionTree'])