Skip to content

Commit

Permalink
🎨 latest colab image has finally pandas 2 (2.0.3)
Browse files Browse the repository at this point in the history
- restriction on matplotlib version not needed anymore

- 🎨 shorten "principal comentent" to PC
  • Loading branch information
Henry committed May 1, 2024
1 parent 9dc73e1 commit 1714a5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
28 changes: 12 additions & 16 deletions docs/tutorial/log_reg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"source": [
"# Setup colab installation\n",
"# You need to restart the runtime after running this cell\n",
"# (due to a pandas 1.5.3 and matplotlib >3.7 incompability - 23-11-07)\n",
"%pip install njab heatmapz openpyxl \"matplotlib<3.7\" plotly"
"%pip install njab heatmapz openpyxl plotly"
]
},
{
Expand All @@ -47,32 +46,28 @@
"from pathlib import Path\n",
"from typing import Optional\n",
"\n",
"from IPython.display import display\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"import plotly.express as px\n",
"import matplotlib.pyplot as plt\n",
"import seaborn\n",
"from heatmap import corrplot\n",
"import umap\n",
"\n",
"import sklearn\n",
"import sklearn.impute\n",
"from sklearn.metrics import make_scorer, log_loss\n",
"import statsmodels.api as sm\n",
"import umap\n",
"from heatmap import corrplot\n",
"from IPython.display import display\n",
"from sklearn.metrics import log_loss, make_scorer\n",
"\n",
"import njab.sklearn\n",
"from njab.plotting.metrics import plot_auc, plot_prc\n",
"from njab.sklearn import StandardScaler\n",
"from njab.sklearn import pca as njab_pca\n",
"from njab.sklearn.scoring import ConfusionMatrix\n",
"from njab.sklearn.scoring import (ConfusionMatrix,\n",
" get_lr_multiplicative_decomposition,\n",
" get_pred, get_score,\n",
" get_target_count_per_bin)\n",
"from njab.sklearn.types import Splits\n",
"from njab.plotting.metrics import plot_auc, plot_prc\n",
"from njab.sklearn.scoring import (get_score,\n",
" get_pred,\n",
" get_target_count_per_bin,\n",
" get_lr_multiplicative_decomposition)\n",
"\n",
"logger = logging.getLogger('njab')\n",
"logger.setLevel(logging.INFO)\n",
Expand Down Expand Up @@ -588,6 +583,7 @@
"files_out['scatter_first_5PCs.pdf'] = FOLDER / 'scatter_first_5PCs.pdf'\n",
"\n",
"fig, axes = plt.subplots(5, 2, figsize=(6, 8), layout='constrained')\n",
"PCs.columns = [s.replace(\"principal component\", \"PC\") for s in PCs.columns]\n",
"PCs = PCs.join(y.astype('category'))\n",
"up_to = min(PCs.shape[-1], 5)\n",
"# https://github.com/matplotlib/matplotlib/issues/25538\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/log_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
# %% tags=["hide-output"]
# Setup colab installation
# You need to restart the runtime after running this cell
# (due to a pandas 1.5.3 and matplotlib >3.7 incompability - 23-11-07)
# %pip install njab heatmapz openpyxl "matplotlib<3.7" plotly
# %pip install njab heatmapz openpyxl plotly

# %% tags=["hide-input"]
import itertools
Expand Down Expand Up @@ -285,6 +284,7 @@
files_out['scatter_first_5PCs.pdf'] = FOLDER / 'scatter_first_5PCs.pdf'

fig, axes = plt.subplots(5, 2, figsize=(6, 8), layout='constrained')
PCs.columns = [s.replace("principal component", "PC") for s in PCs.columns]
PCs = PCs.join(y.astype('category'))
up_to = min(PCs.shape[-1], 5)
# https://github.com/matplotlib/matplotlib/issues/25538
Expand Down

0 comments on commit 1714a5d

Please sign in to comment.