Skip to content

Commit f09556d

Browse files
committed
formatting
1 parent c0c5699 commit f09556d

File tree

2 files changed

+45
-43
lines changed

2 files changed

+45
-43
lines changed

notebooks/Benchmark_MNIST.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
},
292292
{
293293
"cell_type": "code",
294-
"execution_count": 6,
294+
"execution_count": null,
295295
"metadata": {},
296296
"outputs": [
297297
{
@@ -334,7 +334,7 @@
334334
"ax.set_yticks(y_ticks)\n",
335335
"ax.get_yaxis().set_major_formatter(lambda x, pos: f\"$10^{{{int(x)}}}$\")\n",
336336
"ax.get_yaxis().set_minor_locator(\n",
337-
" FixedLocator(locs=np.concat((\n",
337+
" FixedLocator(locs=np.concatenate((\n",
338338
" np.log10(np.arange(0.2, 1, 0.1) * 10.0 ** y_ticks[0]),\n",
339339
" np.log10(np.arange(2, 10) * 10.0 ** y_ticks[None].T).ravel())\n",
340340
" ))\n",

notebooks/Benchmark_recall.ipynb

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,28 +1100,28 @@
11001100
}
11011101
],
11021102
"source": [
1103-
"sized_fig(1/2)\n",
1103+
"sized_fig(1 / 2)\n",
11041104
"sns.pointplot(\n",
11051105
" exploded,\n",
11061106
" x=\"boruvka_iteration\",\n",
11071107
" y=\"boruvka_recall\",\n",
1108-
" hue='dataset',\n",
1108+
" hue=\"dataset\",\n",
11091109
" hue_order=dataset_order,\n",
11101110
" ci=95,\n",
11111111
" units=\"repeat\",\n",
1112-
" markers=['o', 's', 'd', 'x', 'v', 'p'],\n",
1112+
" markers=[\"o\", \"s\", \"d\", \"x\", \"v\", \"p\"],\n",
11131113
" linewidth=0.5,\n",
1114-
" linestyle=':',\n",
1114+
" linestyle=\":\",\n",
11151115
" markersize=3,\n",
11161116
" palette=\"tab10\",\n",
11171117
" native_scale=True,\n",
11181118
" legend=False,\n",
11191119
")\n",
11201120
"plt.ylim([0, 1.05])\n",
1121-
"plt.ylabel('Bor\\\\r{u}vka recall')\n",
1122-
"plt.xlabel('Bor\\\\r{u}vka iteration')\n",
1121+
"plt.ylabel(\"Bor\\\\r{u}vka recall\")\n",
1122+
"plt.xlabel(\"Bor\\\\r{u}vka iteration\")\n",
11231123
"plt.subplots_adjust(0.2, 0.24, 0.95, 0.95)\n",
1124-
"plt.savefig('images/boruvka_recall_vs_iterations.pdf')\n",
1124+
"plt.savefig(\"images/boruvka_recall_vs_iterations.pdf\", pad_inches=0)\n",
11251125
"plt.show()"
11261126
]
11271127
},
@@ -1244,7 +1244,9 @@
12441244
}
12451245
],
12461246
"source": [
1247-
"exploded.groupby(['dataset', 'boruvka_iteration']).boruvka_recall.mean().unstack().reindex(dataset_order)"
1247+
"exploded.groupby(\n",
1248+
" [\"dataset\", \"boruvka_iteration\"]\n",
1249+
").boruvka_recall.mean().unstack().reindex(dataset_order)"
12481250
]
12491251
},
12501252
{
@@ -1258,7 +1260,7 @@
12581260
},
12591261
{
12601262
"cell_type": "code",
1261-
"execution_count": 60,
1263+
"execution_count": null,
12621264
"metadata": {},
12631265
"outputs": [
12641266
{
@@ -1273,30 +1275,30 @@
12731275
}
12741276
],
12751277
"source": [
1276-
"sized_fig(1/2)\n",
1278+
"sized_fig(1 / 2)\n",
12771279
"display = exploded.copy()\n",
1278-
"display['dataset'].replace(display_name, inplace=True)\n",
1280+
"display[\"dataset\"].replace(display_name, inplace=True)\n",
12791281
"sns.pointplot(\n",
12801282
" display,\n",
12811283
" x=\"boruvka_iteration\",\n",
12821284
" y=\"descent_final_recall\",\n",
1283-
" hue='dataset',\n",
1285+
" hue=\"dataset\",\n",
12841286
" hue_order=[display_name[l] for l in dataset_order],\n",
12851287
" ci=95,\n",
12861288
" units=\"repeat\",\n",
1287-
" markers=['o', 's', 'd', 'x', 'v', 'p'],\n",
1289+
" markers=[\"o\", \"s\", \"d\", \"x\", \"v\", \"p\"],\n",
12881290
" linewidth=0.5,\n",
1289-
" linestyle=':',\n",
1291+
" linestyle=\":\",\n",
12901292
" markersize=3,\n",
12911293
" palette=\"tab10\",\n",
1292-
" native_scale=True\n",
1294+
" native_scale=True,\n",
12931295
")\n",
1294-
"plt.legend(title='')\n",
1296+
"plt.legend(title=\"\")\n",
12951297
"plt.ylim([0, 1.05])\n",
1296-
"plt.ylabel('Descent recall')\n",
1297-
"plt.xlabel('Bor\\\\r{u}vka iteration')\n",
1298+
"plt.ylabel(\"Descent recall\")\n",
1299+
"plt.xlabel(\"Bor\\\\r{u}vka iteration\")\n",
12981300
"plt.subplots_adjust(0.2, 0.24, 0.95, 0.95)\n",
1299-
"plt.savefig('images/descent_recall_vs_iteration.pdf')\n",
1301+
"plt.savefig(\"images/descent_recall_vs_iteration.pdf\", pad_inches=0)\n",
13001302
"plt.show()"
13011303
]
13021304
},
@@ -1309,7 +1311,7 @@
13091311
},
13101312
{
13111313
"cell_type": "code",
1312-
"execution_count": 61,
1314+
"execution_count": null,
13131315
"metadata": {},
13141316
"outputs": [
13151317
{
@@ -1324,34 +1326,34 @@
13241326
}
13251327
],
13261328
"source": [
1327-
"sized_fig(1/2)\n",
1329+
"sized_fig(1 / 2)\n",
13281330
"sns.pointplot(\n",
13291331
" exploded,\n",
13301332
" x=\"num_neighbors\",\n",
13311333
" y=\"boruvka_recall\",\n",
1332-
" hue='dataset',\n",
1334+
" hue=\"dataset\",\n",
13331335
" hue_order=dataset_order,\n",
13341336
" ci=95,\n",
13351337
" units=\"repeat\",\n",
1336-
" markers=['o', 's', 'd', 'x', 'v', 'p'],\n",
1338+
" markers=[\"o\", \"s\", \"d\", \"x\", \"v\", \"p\"],\n",
13371339
" linewidth=0.5,\n",
1338-
" linestyle=':',\n",
1340+
" linestyle=\":\",\n",
13391341
" markersize=3,\n",
13401342
" palette=\"tab10\",\n",
13411343
" native_scale=True,\n",
13421344
" legend=False,\n",
13431345
")\n",
13441346
"plt.ylim([0, 1.05])\n",
1345-
"plt.ylabel('Bor\\\\r{u}vka recall')\n",
1346-
"plt.xlabel('Num. neighbors ($k$)')\n",
1347+
"plt.ylabel(\"Bor\\\\r{u}vka recall\")\n",
1348+
"plt.xlabel(\"Num. neighbors ($k$)\")\n",
13471349
"plt.subplots_adjust(0.2, 0.24, 0.95, 0.95)\n",
1348-
"plt.savefig('images/boruvka_recall_vs_neighbors.pdf')\n",
1350+
"plt.savefig(\"images/boruvka_recall_vs_neighbors.pdf\", pad_inches=0)\n",
13491351
"plt.show()"
13501352
]
13511353
},
13521354
{
13531355
"cell_type": "code",
1354-
"execution_count": 62,
1356+
"execution_count": null,
13551357
"metadata": {},
13561358
"outputs": [
13571359
{
@@ -1366,30 +1368,30 @@
13661368
}
13671369
],
13681370
"source": [
1369-
"sized_fig(1/2)\n",
1371+
"sized_fig(1 / 2)\n",
13701372
"sns.pointplot(\n",
13711373
" exploded,\n",
13721374
" x=\"min_descent_neighbors\",\n",
13731375
" y=\"boruvka_distance_fraction\",\n",
1374-
" hue='dataset',\n",
1376+
" hue=\"dataset\",\n",
13751377
" hue_order=dataset_order,\n",
13761378
" ci=95,\n",
13771379
" units=\"repeat\",\n",
1378-
" markers=['o', 's', 'd', 'x', 'v', 'p'],\n",
1380+
" markers=[\"o\", \"s\", \"d\", \"x\", \"v\", \"p\"],\n",
13791381
" linewidth=0.5,\n",
1380-
" linestyle=':',\n",
1382+
" linestyle=\":\",\n",
13811383
" markersize=3,\n",
13821384
" palette=\"tab10\",\n",
13831385
" legend=False,\n",
1384-
" native_scale=True\n",
1386+
" native_scale=True,\n",
13851387
")\n",
13861388
"plt.ylim([0.98, 1.1])\n",
13871389
"plt.yticks([1, 1.05, 1.1])\n",
13881390
"plt.xticks(min_descent_neighbours)\n",
1389-
"plt.ylabel('Distance fraction')\n",
1390-
"plt.xlabel('Descent neighbors ($k_{descent}$)')\n",
1391+
"plt.ylabel(\"Distance fraction\")\n",
1392+
"plt.xlabel(\"Descent neighbors ($k_{descent}$)\")\n",
13911393
"plt.subplots_adjust(0.2, 0.24, 0.95, 0.95)\n",
1392-
"plt.savefig('images/boruvka_dist_fract_vs_descent_neighbors.pdf', pad_inches=0)\n",
1394+
"plt.savefig(\"images/boruvka_dist_fract_vs_descent_neighbors.pdf\", pad_inches=0)\n",
13931395
"plt.show()"
13941396
]
13951397
},
@@ -1402,7 +1404,7 @@
14021404
},
14031405
{
14041406
"cell_type": "code",
1405-
"execution_count": 63,
1407+
"execution_count": null,
14061408
"metadata": {},
14071409
"outputs": [
14081410
{
@@ -1417,7 +1419,7 @@
14171419
}
14181420
],
14191421
"source": [
1420-
"fig = sized_fig(1/2)\n",
1422+
"fig = sized_fig(1 / 2)\n",
14211423
"for n, k_d in enumerate(twice_exploded.min_descent_neighbors.unique()):\n",
14221424
" for i, it in enumerate(twice_exploded.boruvka_iteration.unique()):\n",
14231425
" if np.isnan(i):\n",
@@ -1439,10 +1441,10 @@
14391441
" plt.ylim([0, 1])\n",
14401442
" # plt.xlim([0, 50])\n",
14411443
" # plt.xticks([0, 25, 50])\n",
1442-
"plt.ylabel('Descent recall')\n",
1443-
"plt.xlabel('Descent iteration') \n",
1444+
"plt.ylabel(\"Descent recall\")\n",
1445+
"plt.xlabel(\"Descent iteration\")\n",
14441446
"plt.subplots_adjust(0.16, 0.24, 0.95, 0.95)\n",
1445-
"plt.savefig('images/descent_convergence.pdf', pad_inches=0)\n",
1447+
"plt.savefig(\"images/descent_convergence.pdf\", pad_inches=0)\n",
14461448
"plt.show()"
14471449
]
14481450
}

0 commit comments

Comments
 (0)