Files
tsllm_personalization_icl/analysis/analyze_preliminary.ipynb
Hyungjun Yoon ee711d6034 first commit
2026-01-09 13:09:34 +09:00

97 lines
2.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"id": "a0874e1b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Correct: 1038, Total: 2149, Accuracy: 0.4830153559795254\n"
]
}
],
"source": [
"from glob import glob\n",
"import os\n",
"\n",
"correct = 0\n",
"total = 0\n",
"summary_paths = glob(\"/mnt/sting/hjyoon/projects/tsllm_personalization_icl/logs/SleepEDF/*/*/*/summary.txt\")\n",
"for summary_path in summary_paths:\n",
" with open(summary_path, \"r\") as f:\n",
" summary = f.read()\n",
" if summary:\n",
" answer = summary.split(\"Answer: \")[-1].split(\" (Ground truth: \")[0]\n",
" ground_truth = summary.split(\" (Ground truth: \")[-1].split(\")\")[0]\n",
" if answer == ground_truth:\n",
" correct += 1\n",
" total += 1\n",
"print(f\"Correct: {correct}, Total: {total}, Accuracy: {correct/total}\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "f78ffc6f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Correct: 932, Total: 2260, Accuracy: 0.41238938053097346\n"
]
}
],
"source": [
"correct = 0\n",
"total = 0\n",
"summary_paths = glob(\"/mnt/sting/hjyoon/projects/tsllm_personalization_icl/logs/SleepEDF_out_random/*/*/*/summary.txt\")\n",
"for summary_path in summary_paths:\n",
" with open(summary_path, \"r\") as f:\n",
" summary = f.read()\n",
" if summary:\n",
" answer = summary.split(\"Answer: \")[-1].split(\" (Ground truth: \")[0]\n",
" ground_truth = summary.split(\" (Ground truth: \")[-1].split(\")\")[0]\n",
" if answer == ground_truth:\n",
" correct += 1\n",
" total += 1\n",
"print(f\"Correct: {correct}, Total: {total}, Accuracy: {correct/total}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6872381f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "tsllmpers",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}