Skip to content

Commit da59638

Browse files
Apply ruff/flake8-import-conventions rule ICN001
ICN001 `seaborn` should be imported as `sns`
1 parent 4b44b1e commit da59638

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

docs/notebooks/Paper-v1.0.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"import matplotlib.pyplot as plt\n",
1717
"import numpy as np\n",
1818
"import pandas as pd\n",
19-
"import seaborn as sn\n",
19+
"import seaborn as sns\n",
2020
"\n",
21-
"sn.set(style='whitegrid')"
21+
"sns.set(style='whitegrid')"
2222
]
2323
},
2424
{
@@ -192,7 +192,7 @@
192192
" ax = plt.gca()\n",
193193
"\n",
194194
" outer_score = data.loc[data[score].notnull(), [score, 'zscored']]\n",
195-
" sn.distplot(\n",
195+
" sns.distplot(\n",
196196
" outer_score.loc[outer_score.zscored == zscored, score],\n",
197197
" hist=True,\n",
198198
" norm_hist=True,\n",
@@ -318,12 +318,12 @@
318318
},
319319
"outputs": [],
320320
"source": [
321-
"sn.set(style='whitegrid')\n",
321+
"sns.set(style='whitegrid')\n",
322322
"\n",
323323
"fig = plt.figure(figsize=(20, 8))\n",
324324
"ax1 = plt.subplot2grid((2, 4), (0, 0), colspan=2, rowspan=2)\n",
325325
"\n",
326-
"sn.violinplot(\n",
326+
"sns.violinplot(\n",
327327
" x='Classifier',\n",
328328
" y='AUC',\n",
329329
" hue='Split scheme',\n",
@@ -390,8 +390,8 @@
390390
"outputs": [],
391391
"source": [
392392
"zscoreddf = loso_outer.loc[loso_outer.zscored == 0, ['auc', 'acc', 'site']]\n",
393-
"palette = sn.color_palette('cubehelix', len(set(zscoreddf.site)))\n",
394-
"sn.pairplot(\n",
393+
"palette = sns.color_palette('cubehelix', len(set(zscoreddf.site)))\n",
394+
"sns.pairplot(\n",
395395
" zscoreddf.loc[zscoreddf.auc.notnull(), ['auc', 'acc', 'site']], hue='site', palette=palette\n",
396396
")"
397397
]
@@ -405,12 +405,12 @@
405405
"outputs": [],
406406
"source": [
407407
"sites = sorted(set(loso_outer.site.ravel().tolist()))\n",
408-
"palette = sn.color_palette('husl', len(sites))\n",
408+
"palette = sns.color_palette('husl', len(sites))\n",
409409
"fig = plt.figure()\n",
410410
"for i, site in enumerate(sites):\n",
411411
" sitedf = loso_outer.loc[loso_outer.site == site]\n",
412412
" accdf = sitedf.loc[sitedf.zscored == 0]\n",
413-
" sn.distplot(accdf.acc.values.ravel(), bins=20, kde=0, label=site, color=palette[i])\n",
413+
" sns.distplot(accdf.acc.values.ravel(), bins=20, kde=0, label=site, color=palette[i])\n",
414414
"\n",
415415
"fig.gca().legend()\n",
416416
"fig.gca().set_xlim([0.5, 1.0])"

docs/notebooks/Paper-v2.0.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
"outputs": [],
311311
"source": [
312312
"import matplotlib.pyplot as plt\n",
313-
"import seaborn as sn\n",
313+
"import seaborn as sns\n",
314314
"\n",
315315
"rfc_acc = [\n",
316316
" 0.842,\n",
@@ -392,13 +392,13 @@
392392
"\n",
393393
"fig = plt.figure(figsize=(10, 3))\n",
394394
"ax2 = plt.subplot2grid((1, 4), (0, 3))\n",
395-
"plot = sn.violinplot(\n",
395+
"plot = sns.violinplot(\n",
396396
" data=df, x='Model', y='accuracy', ax=ax2, palette=colors, bw=0.1, linewidth=0.7\n",
397397
")\n",
398398
"for i in range(dim):\n",
399399
" ax2.axhline(np.average(allvals[i]), ls='--', color=colors[i], lw=0.8)\n",
400400
"# ax2.axhline(np.percentile(allvals[i], 50), ls='--', color=colors[i], lw=.8)\n",
401-
"# sn.swarmplot(x=\"model\", y=\"accuracy\", data=df, color=\"w\", alpha=.5, ax=ax2);\n",
401+
"# sns.swarmplot(x=\"model\", y=\"accuracy\", data=df, color=\"w\", alpha=.5, ax=ax2);\n",
402402
"ax2.yaxis.tick_right()\n",
403403
"ax2.set_ylabel('')\n",
404404
"ax2.set_xticklabels(ax2.get_xticklabels(), rotation=40)\n",
@@ -507,7 +507,7 @@
507507
"\n",
508508
"fig = plt.figure(figsize=(10, 3))\n",
509509
"ax2 = plt.subplot2grid((1, 4), (0, 3))\n",
510-
"plot = sn.violinplot(data=df, x='Model', y='auc', ax=ax2, palette=colors, bw=0.1, linewidth=0.7)\n",
510+
"plot = sns.violinplot(data=df, x='Model', y='auc', ax=ax2, palette=colors, bw=0.1, linewidth=0.7)\n",
511511
"for i in range(dim):\n",
512512
" ax2.axhline(np.average(allvals[i]), ls='--', color=colors[i], lw=0.8)\n",
513513
"\n",
@@ -585,10 +585,10 @@
585585
},
586586
"outputs": [],
587587
"source": [
588-
"import seaborn as sn\n",
588+
"import seaborn as sns\n",
589589
"from sklearn.externals.joblib import load as loadpkl\n",
590590
"\n",
591-
"sn.set_style('white')\n",
591+
"sns.set_style('white')\n",
592592
"\n",
593593
"# Get the RFC\n",
594594
"estimator = loadpkl(\n",
@@ -667,7 +667,7 @@
667667
" df['Importance'] += [tree.feature_importances_[i]]\n",
668668
"fig = plt.figure(figsize=(20, 6))\n",
669669
"# plt.title(\"Feature importance plot\")\n",
670-
"sn.boxplot(x='Feature', y='Importance', data=pd.DataFrame(df), linewidth=1, notch=True)\n",
670+
"sns.boxplot(x='Feature', y='Importance', data=pd.DataFrame(df), linewidth=1, notch=True)\n",
671671
"plt.xlabel(f'Features selected ({len(features)})')\n",
672672
"# plt.bar(range(nft), importances[indices],\n",
673673
"# color=\"r\", yerr=std[indices], align=\"center\")\n",

0 commit comments

Comments
 (0)