102 lines
107 KiB
Plaintext
102 lines
107 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAKyCAYAAAAEvm1SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy80BEi2AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd1yV9fs/8NdhHTaIAwFRUByIONHUTM00P+FepZlbc2Rp5agsV5mWlSMVNQeO0q+rNM1Cc5uGAu6FAg5AEZXNOYxz//7gd+44cljnBu5z8PV8PHh4uMf7vs7tuQ6ci/dQCIIggIiIiIiIiIiIqAKZyR0AERERERERERG9eFiUIiIiIiIiIiKiCseiFBERERERERERVTgWpYiIiIiIiIiIqMKxKEVERERERERERBWORSkiIiIiIiIiIqpwLEoREREREREREVGFY1GKiIiIiIiIiIgqHItSRERERERERERU4ViUIiIiIiIiIiKiCmdQUSohIQH79+/H7Nmz8cYbb6BatWpQKBRQKBQYOXJkqds7ePAg+vXrh1q1akGpVKJWrVro168fDh48WOI2cnJysHr1arzyyiuoXr06bGxsUK9ePYwfPx5Xr14tdUxERERERERERFR+FIIgCKU+SaEodN+IESMQHBxconY0Gg3effddrF+/vtBjxo4dizVr1sDMrPD6WWJiIgIDA3Hu3Dm9+5VKJVasWIGxY8eWKC4iIiIiIiIiIipfkofv1a5dG6+//rpB586aNUssSLVo0QLbtm1DaGgotm3bhhYtWgAA1q1bh88//7zQNnJzc9GvXz+xINW/f38cPHgQ//77L5YvX44aNWpArVZj/Pjxpep5RURERERERERE5cegnlJz5sxB69at0bp1a7i6uiImJgbe3t4ASt5T6tatW/Dz80NOTg4CAgJw4sQJ2NjYiPszMjLQqVMnnD9/HhYWFrh+/Tp8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bXc3FxYW1vLHQaVIXt7ezg5OeHevXtITEyEq6truVyHE50TERERERFVEEEQkJSUBAcHBxakiMio2djYwNHREampqeVWwGdRishA1apVkzsEIpPHPCKShjlEJF1F51FOTg7UajWcnJwq9LpE5cnCgoOwKisHBwdkZ2cjOzu7XNpnUYrIQHXr1pU7BCKTxzwikoY5RCRdRedRbm4uAH6Ip8pFqVTKHQKVE+1cUuW1GAOLUkQGunz5stwhEJk85hGRNMwhIunkyiNOaE6VSUZGhtwhUDkp7/cqFqWIDJSZmSl3CEQmj3lEJA1ziEg65hGRdFx4gwzFohQREREREREREVU4FqWIDGRvby93CEQmj3lEJA1ziEg65hGRdGZmLC2QYfjKITJQ48aN5Q6ByOQxj4ikYQ4RScc8IpLOxsZG7hDIRLEoRWSgyMhIuUMgMnnMIyJpmENE0jGPiKRTqVRyh0AmikUpIgM9e/ZM7hCITB7ziEga5hCRdMyjyu/YsWNQKBSFftnb26NBgwYYNmwYjhw5Umg7MTExRbaj76tv376FtvfgwQPMnTsXr7zyCqpXrw5LS0vY2NigVq1a6NixI6ZMmYJdu3YhOTlZPKdz586ljuH5r+Dg4DK8u3lyc3PLvE16MVjIHQARERERERHpd+/ePSQmJsodRrmpVq0aateuLWsM6enpiIyMRGRkJLZu3Yrhw4djw4YNMDc3L7dr/vTTT5g6dSoyMjJ0tufk5CA2NhaxsbE4efIkli9fjrfeegvbt28vt1iI5MSiFJGByvOHFNGLgnlEJA1ziEg6Y86je/fuwdfXt0DhojKxtbXF9evXK6wwNXHiREyaNEn8XhAEPH36FGfOnMGSJUuQkJCAzZs3w9PTE1999VWh7fT
|
||
|
"text/plain": [
|
||
|
"<Figure size 1200x700 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import matplotlib.patches as mpatches\n",
|
||
|
"\n",
|
||
|
"folds = ['Fold 1', 'Fold 2', 'Fold 3', 'Fold 4', 'Fold 5']\n",
|
||
|
"TinyBert = [91.29, 88.32, 93.57, 94.24, 91.71]\n",
|
||
|
"Albert = [86.46, 88.5, 94.33, 94.53, 86.49]\n",
|
||
|
"DistilBert = [92.19, 90.19, 95.28, 95.67, 91.98]\n",
|
||
|
"Bert = [92.19, 89.95, 95.13, 95.1, 91.66]\n",
|
||
|
"\n",
|
||
|
"data = np.array([TinyBert, Albert, DistilBert, Bert])\n",
|
||
|
"max_indices = np.argmax(data, axis=0)\n",
|
||
|
"\n",
|
||
|
"x = np.arange(len(folds))\n",
|
||
|
"width = 0.2\n",
|
||
|
"colors = plt.cm.Spectral(np.linspace(0, 1, 4))\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(figsize=(12,7))\n",
|
||
|
"\n",
|
||
|
"labels = ['TinyBert', 'Albert', 'DistilBert', 'Bert']\n",
|
||
|
"rects = []\n",
|
||
|
"for i in range(4):\n",
|
||
|
" rect = ax.bar(x + (i - 1.5)*width, data[i], width, label=labels[i], color=colors[i], edgecolor='black', linewidth=1.5, zorder=3)\n",
|
||
|
" rects.append(rect)\n",
|
||
|
"\n",
|
||
|
"for fold in range(len(folds)):\n",
|
||
|
" max_idx = max_indices[fold]\n",
|
||
|
" rects[max_idx].patches[fold].set_hatch('//')\n",
|
||
|
"\n",
|
||
|
"TinyBert_mean = np.mean(TinyBert)\n",
|
||
|
"Albert_mean = np.mean(Albert)\n",
|
||
|
"DistilBert_mean = np.mean(DistilBert)\n",
|
||
|
"Bert_mean = np.mean(Bert)\n",
|
||
|
"\n",
|
||
|
"ax.axhline(y=TinyBert_mean, color=colors[0], linestyle='--', label='TinyBert Mean', zorder=2)\n",
|
||
|
"ax.axhline(y=Albert_mean, color=colors[1], linestyle='--', zorder=2)\n",
|
||
|
"ax.axhline(y=DistilBert_mean, color=colors[2], linestyle='--', zorder=2)\n",
|
||
|
"ax.axhline(y=Bert_mean, color=colors[3], linestyle='--', label='Bert Mean', zorder=2)\n",
|
||
|
"\n",
|
||
|
"max_mean = max(TinyBert_mean, Albert_mean, DistilBert_mean, Bert_mean)\n",
|
||
|
"min_mean = min(TinyBert_mean, Albert_mean, DistilBert_mean, Bert_mean)\n",
|
||
|
"\n",
|
||
|
"ax.text(x[1], max_mean + 0.5, f'Max: {max_mean:.2f}%', ha='center', fontsize=20, color='black', zorder=3)\n",
|
||
|
"ax.text(x[1], min_mean + 0.5, f'Min: {min_mean:.2f}%', ha='center', fontsize=20, color='black', zorder=3)\n",
|
||
|
"\n",
|
||
|
"ax.set_ylim([85, 100])\n",
|
||
|
"ax.set_xticks(x)\n",
|
||
|
"ax.set_xticklabels(folds, fontsize=20)\n",
|
||
|
"ax.grid(True, which='both', linestyle='--', linewidth=0.7, alpha=0.7, zorder=1)\n",
|
||
|
"ax.tick_params(axis='both', which='major', labelsize=20)\n",
|
||
|
"\n",
|
||
|
"hatch_patch = mpatches.Patch(facecolor='white', edgecolor='black', hatch='//', label='BEST')\n",
|
||
|
"legend_handles, legend_labels = ax.get_legend_handles_labels()\n",
|
||
|
"legend = ax.legend(handles=[hatch_patch] + legend_handles, fontsize=20, loc='upper right')\n",
|
||
|
"\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"plt.show()\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "torch",
|
||
|
"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
|
||
|
}
|