Update app.py
Browse files
app.py
CHANGED
|
@@ -434,13 +434,13 @@ def train_and_evaluate(input_file):
|
|
| 434 |
amaj1=y_train_full.value_counts().idxmax()
|
| 435 |
amin1=y_train_full.value_counts().idxmin()
|
| 436 |
#print(y.value_counts().idxmax())
|
| 437 |
-
y_train_full=y_train_full.replace([amin1,amaj1],[1,0])
|
| 438 |
|
| 439 |
y_test_full = inter_input[outcome_col]
|
| 440 |
amaj1=y_test_full.value_counts().idxmax()
|
| 441 |
amin1=y_test_full.value_counts().idxmin()
|
| 442 |
#print(y.value_counts().idxmax())
|
| 443 |
-
y_test_full=y_test_full.replace([amin1,amaj1],[1,0])
|
| 444 |
|
| 445 |
X_train,y_train=X_train_full.values,y_train_full.values
|
| 446 |
x_te,y_test=my_test_real.values,y_test_full.values
|
|
@@ -591,7 +591,7 @@ def create_interface():
|
|
| 591 |
metrics_df, calibration_df, calibration_plots = train_and_evaluate(file)
|
| 592 |
|
| 593 |
if isinstance(metrics_df, str): # Error case
|
| 594 |
-
return metrics_df, None, None, None, None, None, None
|
| 595 |
|
| 596 |
|
| 597 |
plot_outputs = [None] * 6
|
|
@@ -620,4 +620,4 @@ if __name__ == "__main__":
|
|
| 620 |
inbrowser=True,
|
| 621 |
height=800,
|
| 622 |
show_error=True
|
| 623 |
-
)
|
|
|
|
| 434 |
amaj1=y_train_full.value_counts().idxmax()
|
| 435 |
amin1=y_train_full.value_counts().idxmin()
|
| 436 |
#print(y.value_counts().idxmax())
|
| 437 |
+
y_train_full=y_train_full.replace([amin1,amaj1],[1,0]).astype(int) # FIX 1: added .astype(int)
|
| 438 |
|
| 439 |
y_test_full = inter_input[outcome_col]
|
| 440 |
amaj1=y_test_full.value_counts().idxmax()
|
| 441 |
amin1=y_test_full.value_counts().idxmin()
|
| 442 |
#print(y.value_counts().idxmax())
|
| 443 |
+
y_test_full=y_test_full.replace([amin1,amaj1],[1,0]).astype(int) # FIX 1: added .astype(int)
|
| 444 |
|
| 445 |
X_train,y_train=X_train_full.values,y_train_full.values
|
| 446 |
x_te,y_test=my_test_real.values,y_test_full.values
|
|
|
|
| 591 |
metrics_df, calibration_df, calibration_plots = train_and_evaluate(file)
|
| 592 |
|
| 593 |
if isinstance(metrics_df, str): # Error case
|
| 594 |
+
return metrics_df, None, None, None, None, None, None, None # FIX 2: 8 values
|
| 595 |
|
| 596 |
|
| 597 |
plot_outputs = [None] * 6
|
|
|
|
| 620 |
inbrowser=True,
|
| 621 |
height=800,
|
| 622 |
show_error=True
|
| 623 |
+
)
|