mirror of
https://github.com/jung-geun/PSO.git
synced 2025-12-19 20:44:39 +09:00
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import matplotlib.pyplot as plt\n",
|
|
"import numpy as np\n",
|
|
"import pandas as pd\n",
|
|
"\n",
|
|
"%matplotlib inline\n",
|
|
"\n",
|
|
"data = pd.read_csv(\"result/mnist/07-13-02-05_75_200_0.25_0.4_0.3_acc.csv\", header=None)\n",
|
|
"print(data.shape)\n",
|
|
"\n",
|
|
"loss = pd.DataFrame()\n",
|
|
"acc = pd.DataFrame()\n",
|
|
"\n",
|
|
"for i in range(len(data.iloc[0])):\n",
|
|
" if i % 2 == 0:\n",
|
|
" loss[i] = data[i]\n",
|
|
" else:\n",
|
|
" acc[i] = data[i]\n",
|
|
"\n",
|
|
"print(loss.shape, acc.shape)\n",
|
|
"\n",
|
|
"fig, axes = plt.subplots(nrows=2, sharey=False, sharex=True, figsize=(6, 6))\n",
|
|
"\n",
|
|
"loss.replace('nan' ,np.inf ,inplace=True)\n",
|
|
"loss = loss.fillna(np.inf)\n",
|
|
"\n",
|
|
"loss.plot(kind=\"line\", ax=axes[0], legend=False, alpha=0.5, ylabel=\"loss\", grid=True, title=f\"best loss {loss.min(numeric_only=True).min()}\")\n",
|
|
"\n",
|
|
"acc.plot(kind=\"line\", ax=axes[1], legend=False, alpha=0.5, ylabel=\"acc\", xlabel=\"epoch\", grid=True, title=f\"best acc {acc.max(numeric_only=True).max()}\")\n",
|
|
"\n",
|
|
"plt.show()\n",
|
|
"plt.clf()\n",
|
|
"plt.clf()\n",
|
|
"plt.close()\n",
|
|
"plt.close()\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "pso",
|
|
"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.9.16"
|
|
},
|
|
"widgets": {
|
|
"application/vnd.jupyter.widget-state+json": {
|
|
"state": {},
|
|
"version_major": 2,
|
|
"version_minor": 0
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|