Use concat instead of append which was deprecated.

master
junos 2023-05-12 16:32:08 +02:00
parent 3091328fc5
commit 87781840d4
1 changed files with 48 additions and 24 deletions

View File

@ -60,36 +60,60 @@ class ClassificationModels:
print("\n************************************\n")
print("Current model:", model_title, end="\n")
print("Acc:", model["metrics"][0] / n_clusters)
scores_df.append(
{
"method": model_title,
"metric": "test_accuracy",
"mean": model["metrics"][0] / n_clusters,
}
scores_df = pd.concat(
[
scores_df,
pd.DataFrame(
{
"method": model_title,
"metric": "test_accuracy",
"mean": model["metrics"][0] / n_clusters,
}
),
],
ignore_index=True,
)
print("Precision:", model["metrics"][1] / n_clusters)
scores_df.append(
{
"method": model_title,
"metric": "test_precision",
"mean": model["metrics"][1] / n_clusters,
}
scores_df = pd.concat(
[
scores_df,
pd.DataFrame(
{
"method": model_title,
"metric": "test_precision",
"mean": model["metrics"][1] / n_clusters,
}
),
],
ignore_index=True,
)
print("Recall:", model["metrics"][2] / n_clusters)
scores_df.append(
{
"method": model_title,
"metric": "test_recall",
"mean": model["metrics"][2] / n_clusters,
}
scores_df = pd.concat(
[
scores_df,
pd.DataFrame(
{
"method": model_title,
"metric": "test_recall",
"mean": model["metrics"][2] / n_clusters,
}
),
],
ignore_index=True,
)
print("F1:", model["metrics"][3] / n_clusters)
scores_df.append(
{
"method": model_title,
"metric": "test_f1",
"mean": model["metrics"][3] / n_clusters,
}
scores_df = pd.concat(
[
scores_df,
pd.DataFrame(
{
"method": model_title,
"metric": "test_f1",
"mean": model["metrics"][3] / n_clusters,
}
),
],
ignore_index=True,
)
scores = pd.concat([scores, scores_df])
return scores