Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -309,29 +309,7 @@ def read_csv_file(uploaded_file):
|
|
| 309 |
return None
|
| 310 |
|
| 311 |
|
| 312 |
-
#-----------------------------------------------------------------calculate topsis score--------------------------------------------------------
|
| 313 |
|
| 314 |
-
def calculate_topsis_score(df):
|
| 315 |
-
# Normalize the data
|
| 316 |
-
norm_df = (df.iloc[:, 1:] - df.iloc[:, 1:].min()) / (df.iloc[:, 1:].max() - df.iloc[:, 1:].min())
|
| 317 |
-
|
| 318 |
-
# Calculate the positive and negative ideal solutions
|
| 319 |
-
ideal_positive = norm_df.max(axis=0)
|
| 320 |
-
ideal_negative = norm_df.min(axis=0)
|
| 321 |
-
|
| 322 |
-
# Calculate the Euclidean distances
|
| 323 |
-
dist_positive = np.sqrt(((norm_df - ideal_positive) ** 2).sum(axis=1))
|
| 324 |
-
dist_negative = np.sqrt(((norm_df - ideal_negative) ** 2).sum(axis=1))
|
| 325 |
-
|
| 326 |
-
# Calculate the TOPSIS score
|
| 327 |
-
topsis_score = dist_negative / (dist_positive + dist_negative)
|
| 328 |
-
|
| 329 |
-
# Add the TOPSIS score to the dataframe
|
| 330 |
-
df['TOPSIS_Score'] = topsis_score
|
| 331 |
-
|
| 332 |
-
return df
|
| 333 |
-
# Calculate the TOPSIS score for the average metrics
|
| 334 |
-
|
| 335 |
|
| 336 |
#--------------------------------------------------- Nested Cross validation---------------------------------------------------------------------------
|
| 337 |
|
|
@@ -501,7 +479,7 @@ def run_cross_validation(training_file, training_additive_file, testing_file, te
|
|
| 501 |
# Default parameters
|
| 502 |
epochs = 1000
|
| 503 |
batch_size = 64
|
| 504 |
-
outer_n_splits =
|
| 505 |
#inner_n_splits = 2
|
| 506 |
min_child_weight=5
|
| 507 |
learning_rate=0.001
|
|
|
|
| 309 |
return None
|
| 310 |
|
| 311 |
|
|
|
|
| 312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
|
| 314 |
#--------------------------------------------------- Nested Cross validation---------------------------------------------------------------------------
|
| 315 |
|
|
|
|
| 479 |
# Default parameters
|
| 480 |
epochs = 1000
|
| 481 |
batch_size = 64
|
| 482 |
+
outer_n_splits = 10
|
| 483 |
#inner_n_splits = 2
|
| 484 |
min_child_weight=5
|
| 485 |
learning_rate=0.001
|