From 58d11ffdfd26568e97bc12975d0cd258201e48e6 Mon Sep 17 00:00:00 2001 From: Lena Ebner Date: Mon, 1 Jan 2024 16:42:45 +0100 Subject: [PATCH] feat: add amount of file calc --- ...sData.ipynb => happiness_evaluation.ipynb} | 65 ++++++++++++------- 1 file changed, 42 insertions(+), 23 deletions(-) rename experiments/{UserData/processData.ipynb => happiness_evaluation.ipynb} (82%) diff --git a/experiments/UserData/processData.ipynb b/experiments/happiness_evaluation.ipynb similarity index 82% rename from experiments/UserData/processData.ipynb rename to experiments/happiness_evaluation.ipynb index 0d26d0a..bf44525 100644 --- a/experiments/UserData/processData.ipynb +++ b/experiments/happiness_evaluation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2023-12-27T14:38:07.208570100Z", @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2023-12-27T14:48:33.003116200Z", @@ -43,23 +43,40 @@ "id": "fbykrjkOjZWq", "outputId": "8c8bd4c8-16e8-41fe-a87b-e9e0d797beac" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Amount of files: 32\n" + ] + } + ], "source": [ "\n", - "base_path = \"D:\\\\Documents\\\\GitHub\\\\CIR\\\\experiments\\\\UserData\"\n", + "base_path = \"./UserData/\"\n", + "# base_path = \"D:\\\\Documents\\\\GitHub\\\\CIR\\\\experiments\\\\UserData\"\n", "\n", "results = {}\n", + "amount_of_files = 0\n", "\n", "# Loop over all the files\n", "for dir in os.listdir(base_path):\n", - " dir_path = base_path + \"\\\\\" + dir\n", + " dir_path = base_path + dir\n", + " # dir_path = base_path + \"\\\\\" + dir\n", + "\n", " # Only check the directories\n", " if os.path.isdir(dir_path):\n", " for file in os.listdir(dir_path):\n", - " file_path = dir_path + \"\\\\\" + file\n", + " file_path = dir_path + \"/\" + file\n", + " # file_path = dir_path + \"\\\\\" + file\n", + "\n", " # Only check the files\n", " if not os.path.isdir(file_path):\n", - " log_path = dir_path + \"\\\\logs\"\n", + " amount_of_files += 1\n", + " log_path = dir_path + \"/logs\"\n", + " # log_path = dir_path + \"\\\\logs\"\n", + " \n", " # Get the excel file and convert to an array with 0, 0.5 and 1\n", " # representing neutral, slight smile and smile\n", " df = pd.read_excel(file_path)\n", @@ -71,7 +88,9 @@ " with open(log_path + \"/\" + log, \"r\") as log_file:\n", " json_log = json.load(log_file)\n", " smile_degree_array = [entry['smileDegree'] for entry in json_log]\n", - " results[file[:-5]] = [result_array, smile_degree_array]" + " results[file[:-5]] = [result_array, smile_degree_array]\n", + " \n", + "print(f\"Amount of files: {amount_of_files}\")" ] }, { @@ -83,16 +102,16 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Total MSE \t = -0.13205479156940012\n", - "MSE A \t\t = -0.13099312341198133\n", - "MSE B \t\t = -0.133265373577282\n" + "Total MSE \t = -0.1195553075097073\n", + "MSE A \t\t = -0.11021458716866875\n", + "MSE B \t\t = -0.12993050502206596\n" ] } ], @@ -133,19 +152,19 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Total happiness \t\t\t = 0.4902676399026764\n", - "Total happiness with recommender \t = 0.6491721614005638\n", - "Total happiness A \t\t\t = 0.4847161572052402\n", - "Total happiness A with recommender \t = 0.6505553012928176\n", - "Total happiness B \t\t\t = 0.49725274725274726\n", - "Total happiness B with recommender \t = 0.6474318370306404\n" + "Total happiness \t\t\t = 0.4926829268292683\n", + "Total happiness with recommender \t = 0.6121423712260986\n", + "Total happiness A \t\t\t = 0.4909090909090909\n", + "Total happiness A with recommender \t = 0.5937602916700374\n", + "Total happiness B \t\t\t = 0.49473684210526314\n", + "Total happiness B with recommender \t = 0.6334268843962747\n" ] } ], @@ -201,15 +220,15 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Happiness first part \t = 0.2347856359841381\n", - "Happiness second part \t = 0.17478925298500678\n" + "Happiness first part \t = 0.224683757843183\n", + "Happiness second part \t = 0.1633900668621427\n" ] } ], @@ -260,7 +279,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.11.6" } }, "nbformat": 4,