Spaces:
Runtime error
Runtime error
Isabel Gwara
commited on
Commit
·
52855ba
1
Parent(s):
a35901d
Update app.py
Browse files
app.py
CHANGED
@@ -111,6 +111,12 @@ def general_predictor(input_list):
|
|
111 |
result = model.predict(new_input)
|
112 |
return cat_value_dicts[final_colname][result[0]]
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
form = st.form('ml-inputs')
|
115 |
|
116 |
# add data labels to replace those lost via star-args
|
@@ -136,9 +142,9 @@ if form.form_submit_button("Submit to get your recommendation!"):
|
|
136 |
form.subheader(prediction)
|
137 |
|
138 |
col1, col2, col3 = st.columns(3)
|
139 |
-
col1.metric("Options", len(cat_value_dicts[final_colname])
|
140 |
-
col2.metric("Accuracy", round(metrics.accuracy_score(y_test, y_pred) * 100, 1)
|
141 |
-
col3.metric("
|
142 |
|
143 |
|
144 |
with open('info.md') as f:
|
|
|
111 |
result = model.predict(new_input)
|
112 |
return cat_value_dicts[final_colname][result[0]]
|
113 |
|
114 |
+
def get_feat():
|
115 |
+
feats = [abs(x) for x in model.coef_[0]]
|
116 |
+
max_val = max(feats)
|
117 |
+
idx = feats.index(max_val)
|
118 |
+
return data.columns[idx]
|
119 |
+
|
120 |
form = st.form('ml-inputs')
|
121 |
|
122 |
# add data labels to replace those lost via star-args
|
|
|
142 |
form.subheader(prediction)
|
143 |
|
144 |
col1, col2, col3 = st.columns(3)
|
145 |
+
col1.metric("Number of Options", len(cat_value_dicts[final_colname]))
|
146 |
+
col2.metric("Model Accuracy", str(round(metrics.accuracy_score(y_test, y_pred) * 100, 1)) + '%')
|
147 |
+
col3.metric("Most Important Question", get_feat())
|
148 |
|
149 |
|
150 |
with open('info.md') as f:
|