fix: add scores.csv checking in ensemble_test (#567)

* add scores.csv checking in ensemble_test

* text modify
This commit is contained in:
XianBW
2025-02-08 19:03:29 +08:00
committed by GitHub
parent 2d5cd556e5
commit 1b193fa2e7
2 changed files with 19 additions and 11 deletions
@@ -67,8 +67,15 @@ if isinstance(final_pred, (list, np.ndarray, pd.DataFrame, torch.Tensor, tf.Tens
f"vs. len(test_X)={len(test_X)}"
)
# check if scores.csv is generated
# check scores.csv
assert Path("scores.csv").exists(), "scores.csv is not generated"
score_df = pd.read_csv("scores.csv", index_col=0)
model_set_in_scores = set(score_df.index)
for model in {{model_names}}:
if model not in model_set_in_scores:
print(f"\nModel {model} is not evaluated in the scores.csv.")
print("Please check scores dataframe's format, it's:")
print(score_df)
print("Ensemble test passed successfully.")
print(f"Output shape: {final_pred.shape}")