diff --git a/exploration/ml_pipeline_classification_with_clustering.py b/exploration/ml_pipeline_classification_with_clustering.py index d4c7f54..f63f110 100644 --- a/exploration/ml_pipeline_classification_with_clustering.py +++ b/exploration/ml_pipeline_classification_with_clustering.py @@ -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, +) diff --git a/machine_learning/classification_models.py b/machine_learning/classification_models.py index 6a2bb1a..1284525 100644 --- a/machine_learning/classification_models.py +++ b/machine_learning/classification_models.py @@ -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,