Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
|
|
16 |
early_stopping_rounds = 0,
|
17 |
scale_pos_weight=1)
|
18 |
'''
|
|
|
19 |
with open('HH_ensemble_classifier_online.json', 'r') as file:
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
classifier_list = loaded_models
|
27 |
'''
|
28 |
xgb_reg.load_model('classifier_fewer_features_HH.json')
|
29 |
'''
|
@@ -40,9 +40,9 @@ def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
|
|
40 |
user_input[cat_features] = user_input[cat_features].copy().astype('category')
|
41 |
|
42 |
|
43 |
-
predictions = np.zeros((len(
|
44 |
-
for i in range(len(
|
45 |
-
predictions[i] =
|
46 |
averaged_prediction = predictions.mean(axis=0)
|
47 |
'''
|
48 |
pred = xgb_reg.predict_proba(user_input)
|
|
|
16 |
early_stopping_rounds = 0,
|
17 |
scale_pos_weight=1)
|
18 |
'''
|
19 |
+
loaded_models = []
|
20 |
with open('HH_ensemble_classifier_online.json', 'r') as file:
|
21 |
+
model_data = json.load(file)
|
22 |
+
for item in model_data:
|
23 |
+
index = item['index']
|
24 |
+
model = pickle.loads(item['model'].encode('latin1'))
|
25 |
+
loaded_models.append(model)
|
26 |
+
|
|
|
27 |
'''
|
28 |
xgb_reg.load_model('classifier_fewer_features_HH.json')
|
29 |
'''
|
|
|
40 |
user_input[cat_features] = user_input[cat_features].copy().astype('category')
|
41 |
|
42 |
|
43 |
+
predictions = np.zeros((len(loaded_models),2))
|
44 |
+
for i in range(len(loaded_models)):
|
45 |
+
predictions[i] = loaded_models[i].predict_proba(user_input[cont_features + cat_features])
|
46 |
averaged_prediction = predictions.mean(axis=0)
|
47 |
'''
|
48 |
pred = xgb_reg.predict_proba(user_input)
|