Update app.py
Browse files
app.py
CHANGED
|
@@ -973,31 +973,31 @@ with tab_train:
|
|
| 973 |
st.info("Upload a training Excel file to enable training.")
|
| 974 |
else:
|
| 975 |
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
|
|
|
| 973 |
st.info("Upload a training Excel file to enable training.")
|
| 974 |
else:
|
| 975 |
|
| 976 |
+
df = pd.read_excel(train_file, engine="openpyxl")
|
| 977 |
+
feature_cols = get_feature_cols_from_df(df)
|
| 978 |
+
|
| 979 |
+
st.dataframe(df.head(), use_container_width=True)
|
| 980 |
+
feature_cols = get_feature_cols_from_df(df)
|
| 981 |
+
|
| 982 |
+
st.markdown("### Choose variable types (saved into the model)")
|
| 983 |
+
default_numeric = feature_cols[:13] # initial suggestion
|
| 984 |
+
num_cols = st.multiselect(
|
| 985 |
+
"Numeric variables (will be median-imputed + scaled)",
|
| 986 |
+
options=feature_cols,
|
| 987 |
+
default=default_numeric
|
| 988 |
+
)
|
| 989 |
+
|
| 990 |
+
# Everything not selected as numeric becomes categorical
|
| 991 |
+
cat_cols = [c for c in feature_cols if c not in num_cols]
|
| 992 |
+
|
| 993 |
+
st.write(f"Categorical variables (will be most-frequent-imputed + one-hot): {len(cat_cols)}")
|
| 994 |
+
st.caption("Note: The selected schema is stored with the trained model and must match inference files.")
|
| 995 |
+
|
| 996 |
+
st.markdown("### Evaluation settings")
|
| 997 |
+
n_bins = st.slider("Calibration bins", 5, 20, 10, 1)
|
| 998 |
+
cal_strategy = st.selectbox("Calibration binning strategy", ["uniform", "quantile"], index=0)
|
| 999 |
+
|
| 1000 |
+
dca_points = st.slider("Decision curve points", 25, 200, 99, 1)
|
| 1001 |
|
| 1002 |
|
| 1003 |
|