Add index when inserting one row.
parent
2c5a0b4157
commit
38a405d378
|
@ -87,7 +87,7 @@ cmodels = cm.get_cmodels()
|
||||||
# %% jupyter={"source_hidden": true}
|
# %% jupyter={"source_hidden": true}
|
||||||
for k in range(N_CLUSTERS):
|
for k in range(N_CLUSTERS):
|
||||||
model_input_subset = model_input[model_input["cluster"] == k].copy()
|
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"] = pd.cut(
|
||||||
model_input_subset.loc[:, "target"],
|
model_input_subset.loc[:, "target"],
|
||||||
bins=bins,
|
bins=bins,
|
||||||
|
@ -204,3 +204,13 @@ for k in range(N_CLUSTERS):
|
||||||
# %% jupyter={"source_hidden": true}
|
# %% jupyter={"source_hidden": true}
|
||||||
# Get overall results
|
# Get overall results
|
||||||
scores = cm.get_total_models_scores(n_clusters=N_CLUSTERS)
|
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,
|
||||||
|
)
|
||||||
|
|
|
@ -68,7 +68,8 @@ class ClassificationModels:
|
||||||
"method": model_title,
|
"method": model_title,
|
||||||
"metric": "test_accuracy",
|
"metric": "test_accuracy",
|
||||||
"mean": model["metrics"][0] / n_clusters,
|
"mean": model["metrics"][0] / n_clusters,
|
||||||
}
|
},
|
||||||
|
index=[0],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
ignore_index=True,
|
ignore_index=True,
|
||||||
|
@ -82,7 +83,8 @@ class ClassificationModels:
|
||||||
"method": model_title,
|
"method": model_title,
|
||||||
"metric": "test_precision",
|
"metric": "test_precision",
|
||||||
"mean": model["metrics"][1] / n_clusters,
|
"mean": model["metrics"][1] / n_clusters,
|
||||||
}
|
},
|
||||||
|
index=[0],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
ignore_index=True,
|
ignore_index=True,
|
||||||
|
@ -96,7 +98,8 @@ class ClassificationModels:
|
||||||
"method": model_title,
|
"method": model_title,
|
||||||
"metric": "test_recall",
|
"metric": "test_recall",
|
||||||
"mean": model["metrics"][2] / n_clusters,
|
"mean": model["metrics"][2] / n_clusters,
|
||||||
}
|
},
|
||||||
|
index=[0],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
ignore_index=True,
|
ignore_index=True,
|
||||||
|
@ -110,7 +113,8 @@ class ClassificationModels:
|
||||||
"method": model_title,
|
"method": model_title,
|
||||||
"metric": "test_f1",
|
"metric": "test_f1",
|
||||||
"mean": model["metrics"][3] / n_clusters,
|
"mean": model["metrics"][3] / n_clusters,
|
||||||
}
|
},
|
||||||
|
index=[0],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
ignore_index=True,
|
ignore_index=True,
|
||||||
|
|
Loading…
Reference in New Issue