Add index when inserting one row.

master
junos 2023-05-17 18:13:20 +02:00
parent 2c5a0b4157
commit 38a405d378
2 changed files with 19 additions and 5 deletions

View File

@ -87,7 +87,7 @@ cmodels = cm.get_cmodels()
# %% jupyter={"source_hidden": true}
for k in range(N_CLUSTERS):
model_input_subset = model_input[model_input["cluster"] == k].copy()
bins = [-10, -1, 1, 10] # bins for z-scored targets
bins = [-1, 1, 2, 4] # bins for z-scored targets
model_input_subset.loc[:, "target"] = pd.cut(
model_input_subset.loc[:, "target"],
bins=bins,
@ -204,3 +204,13 @@ for k in range(N_CLUSTERS):
# %% jupyter={"source_hidden": true}
# Get overall results
scores = cm.get_total_models_scores(n_clusters=N_CLUSTERS)
# %%
scores.to_csv(
"../presentation/results/PANAS_negative_affect_30min_classification_"
+ CV_METHOD
+ "_clust_"
+ str(N_CLUSTERS)
+ ".csv",
index=False,
)

View File

@ -68,7 +68,8 @@ class ClassificationModels:
"method": model_title,
"metric": "test_accuracy",
"mean": model["metrics"][0] / n_clusters,
}
},
index=[0],
),
],
ignore_index=True,
@ -82,7 +83,8 @@ class ClassificationModels:
"method": model_title,
"metric": "test_precision",
"mean": model["metrics"][1] / n_clusters,
}
},
index=[0],
),
],
ignore_index=True,
@ -96,7 +98,8 @@ class ClassificationModels:
"method": model_title,
"metric": "test_recall",
"mean": model["metrics"][2] / n_clusters,
}
},
index=[0],
),
],
ignore_index=True,
@ -110,7 +113,8 @@ class ClassificationModels:
"method": model_title,
"metric": "test_f1",
"mean": model["metrics"][3] / n_clusters,
}
},
index=[0],
),
],
ignore_index=True,