{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 225504 characters]",
      "text/plain": [
       "<Figure size 1400x1000 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Define data\n",
    "bottle_data = {\n",
    "    \"ResNet50\": {\n",
    "        \"1,3,5 shots normal\": [0.5892857142857143, 0.7321428571428571, 0.75],\n",
    "        \"inbalanced - more good shots\": [0.75, 0.732, 0.696, 0.696],\n",
    "        \"2 ways only detect if faulty or not\": [0.8395, 0.8315, 0.8031],\n",
    "        \"inbalance 2 way\": [0.8031, 0.81893, 0.8336, 0.8031],\n",
    "        \"only faulty class detect\": [0.7638, 0.7428, 0.787]\n",
    "    },\n",
    "    \"P>M>F\": {\n",
    "        \"1,3,5 shots normal\": [0.67910401, 0.71710526, 0.78860294],\n",
    "        \"inbalanced - more good shots\": [0.78768382, 0.78860294, 0.75827206, 0.74356618],\n",
    "        \"2 ways only detect if faulty or not\": [0.86422306, 0.93201754, 0.93933824],\n",
    "        \"inbalance 2 way\": [0.92371324, 0.87867647, 0.86397059, 0.87775735],\n",
    "        \"only faulty class detect\": [0.57380952, 0.76705653, 0.84191176]\n",
    "    },\n",
    "    \"CAML\": {\n",
    "        \"1,3,5 shots normal\": [0.40740741, 0.39726027, 0.30769231],\n",
    "        \"2 ways only detect if faulty or not\": [0.79012346, 0.84415584, 0.87671233],\n",
    "        \"only faulty class detect\": [0.58064516, 0.51785714, 0.52]\n",
    "    }\n",
    "}\n",
    "\n",
    "cable_data = {\n",
    "    \"ResNet50\": {\n",
    "        \"1,3,5 shots normal\": [0.21808, 0.43815, 0.4321478],\n",
    "        \"inbalanced - more good shots\": [0.4321478, 0.432986, 0.42340, 0.4464635],\n",
    "        \"2 ways only detect if faulty or not\": [0.8592, 0.8772, 0.8495],\n",
    "        \"inbalance 2 way\": [0.8495, 0.8180, 0.7460, 0.6846],\n",
    "        \"only faulty class detect\": [0.240, 0.4740, 0.4805]\n",
    "    },\n",
    "    \"P>M>F\": {\n",
    "        \"1,3,5 shots normal\": [0.25199021, 0.44388328, 0.46975059],\n",
    "        \"inbalanced - more good shots\": [0.50425859, 0.48023277, 0.43118282, 0.41842534],\n",
    "        \"2 ways only detect if faulty or not\": [0.79263485, 0.8707712, 0.86756514],\n",
    "        \"inbalance 2 way\": [0.86966158, 0.80142425, 0.80961366, 0.66028834],\n",
    "        \"only faulty class detect\": [0.24383256, 0.43800505, 0.51304563]\n",
    "    },\n",
    "    \"CAML\": {\n",
    "        \"1,3,5 shots normal\": [0.24031008, 0.19834711, 0.15929204],\n",
    "        \"2 ways only detect if faulty or not\": [0.57364341, 0.54545455, 0.59292035],\n",
    "        \"only faulty class detect\": [0.12962963, 0.36363636, 0.58823529]\n",
    "    }\n",
    "}\n",
    "# Prepare the data\n",
    "measurement_types = [\n",
    "    \"1,3,5 shots normal\",\n",
    "    \"inbalanced - more good shots\",\n",
    "    \"2 ways only detect if faulty or not\",\n",
    "    \"inbalance 2 way\",\n",
    "    \"only faulty class detect\"\n",
    "]\n",
    "\n",
    "models = [\"ResNet50\", \"P>M>F\", \"CAML\"]\n",
    "\n",
    "# Create subplots\n",
    "fig, axes = plt.subplots(3, 2, figsize=(14, 10))\n",
    "axes = axes.flatten()\n",
    "\n",
    "# Loop through each measurement type\n",
    "for i, measurement in enumerate(measurement_types):\n",
    "    ax = axes[i]\n",
    "    for model in models:\n",
    "        # Get the bottle and cable data for the current measurement and model\n",
    "        bottle_accuracy = bottle_data[model].get(measurement, [])\n",
    "        cable_accuracy = cable_data[model].get(measurement, [])\n",
    "        \n",
    "        # Plot both bottle and cable data\n",
    "        ax.plot(bottle_accuracy, marker='o', label=f'{model} - Bottle', linestyle='-')\n",
    "        \n",
    "    ax.set_title(measurement)\n",
    "    ax.set_xlabel(\"Shots / Samples\")\n",
    "    ax.set_ylabel(\"Accuracy\")\n",
    "    ax.legend()\n",
    "    ax.grid(True)\n",
    "\n",
    "# Adjust layout\n",
    "plt.tight_layout()\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 221440 characters]",
      "text/plain": [
       "<Figure size 1400x1000 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Create subplots\n",
    "fig, axes = plt.subplots(3, 2, figsize=(14, 10))\n",
    "axes = axes.flatten()\n",
    "\n",
    "# Loop through each measurement type\n",
    "for i, measurement in enumerate(measurement_types):\n",
    "    ax = axes[i]\n",
    "    for model in models:\n",
    "        # Get the bottle and cable data for the current measurement and model\n",
    "        bottle_accuracy = bottle_data[model].get(measurement, [])\n",
    "        cable_accuracy = cable_data[model].get(measurement, [])\n",
    "        \n",
    "        # Plot both bottle and cable data\n",
    "        ax.plot(cable_accuracy, marker='o', label=f'{model} - Cable', linestyle='-')\n",
    "        \n",
    "    ax.set_title(measurement)\n",
    "    ax.set_xlabel(\"Shots / Samples\")\n",
    "    ax.set_ylabel(\"Accuracy\")\n",
    "    ax.legend()\n",
    "    ax.grid(True)\n",
    "\n",
    "# Adjust layout\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
