From 43bd8f3cbb1dcbec78931ac1f2e6362490907d5c Mon Sep 17 00:00:00 2001 From: Nitin Madnani Date: Fri, 1 May 2020 09:28:14 -0400 Subject: [PATCH 1/3] Remove statsmodels futurewarnings filter in `modeler.py`. --- rsmtool/modeler.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rsmtool/modeler.py b/rsmtool/modeler.py index 385dc482e..75b0418dd 100644 --- a/rsmtool/modeler.py +++ b/rsmtool/modeler.py @@ -11,13 +11,13 @@ import logging import pickle -import warnings from math import log10, sqrt from os.path import join import numpy as np import pandas as pd +import statsmodels.api as sm from numpy.random import RandomState from scipy.optimize import nnls @@ -31,10 +31,6 @@ from .preprocessor import FeaturePreprocessor from .writer import DataWriter -with warnings.catch_warnings(): - warnings.filterwarnings('ignore', category=FutureWarning) - import statsmodels.api as sm - class Modeler: """ From 2d6961ec0a32ae2c4b28a93b6baf39ea3366a6cc Mon Sep 17 00:00:00 2001 From: Nitin Madnani Date: Fri, 1 May 2020 09:38:10 -0400 Subject: [PATCH 2/3] Remove statsmodels warning filter from header notebook. --- rsmtool/notebooks/header.ipynb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rsmtool/notebooks/header.ipynb b/rsmtool/notebooks/header.ipynb index 86d7a9ff3..fbd3f6ba0 100644 --- a/rsmtool/notebooks/header.ipynb +++ b/rsmtool/notebooks/header.ipynb @@ -41,6 +41,7 @@ "import pandas as pd\n", "import seaborn as sns\n", "import scipy.stats as stats\n", + "import statsmodels.api as sm\n", "from matplotlib import pyplot as plt\n", "from textwrap import wrap\n", "\n", @@ -61,10 +62,6 @@ "\n", "from rsmtool.version import VERSION as rsmtool_version\n", "\n", - "with warnings.catch_warnings():\n", - " warnings.filterwarnings('ignore', category=FutureWarning)\n", - " import statsmodels.api as sm\n", - "\n", "sns.set_context('notebook')" ] }, From d4b1477bc2c1e504880c44bb3660bfae8fbde668 Mon Sep 17 00:00:00 2001 From: Nitin Madnani Date: Fri, 1 May 2020 09:45:22 -0400 Subject: [PATCH 3/3] Remove warning filter for KDE estimate in features section. --- rsmtool/notebooks/preprocessed_features.ipynb | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/rsmtool/notebooks/preprocessed_features.ipynb b/rsmtool/notebooks/preprocessed_features.ipynb index 4abefc390..31823a803 100644 --- a/rsmtool/notebooks/preprocessed_features.ipynb +++ b/rsmtool/notebooks/preprocessed_features.ipynb @@ -50,35 +50,30 @@ " col_wrap = 3\n", " aspect = 1\n", "\n", - "# There's a weird deprecation warning that comes from within statsmodels\n", - "# code which is used by seaborn to compute the kernel density estimate.\n", - "# Until statsmodels fixes it, we need to ignore that warning.\n", - "with warnings.catch_warnings():\n", - " warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning)\n", - " with sns.axes_style('white'):\n", - " g = sns.FacetGrid(col='variable', data=df_train_preproc_melted, col_wrap=col_wrap, \n", - " col_order=column_order, sharex=False, sharey=False, height=height, \n", - " aspect=aspect)\n", - " g.map(sns.distplot, \"value\", color=\"grey\", kde=False)\n", - " for ax, cname in zip(g.axes, g.col_names):\n", - " labels = ax.get_xticks()\n", - " ax.set_xlabel('')\n", - " ax.set_xticklabels(labels, rotation=90)\n", - " plot_title = '\\n'.join(wrap(str(cname), 30))\n", - " ax.set_title(plot_title)\n", - "\n", - " # we want to try to force `tight_layout()`, but if this \n", - " # raises a warning, we don't want the entire notebook to fail\n", - " with warnings.catch_warnings():\n", - " warnings.simplefilter('ignore')\n", - " plt.tight_layout(h_pad=1.0)\n", + "with sns.axes_style('white'):\n", + " g = sns.FacetGrid(col='variable', data=df_train_preproc_melted, col_wrap=col_wrap, \n", + " col_order=column_order, sharex=False, sharey=False, height=height, \n", + " aspect=aspect)\n", + " g.map(sns.distplot, \"value\", color=\"grey\", kde=False)\n", + " for ax, cname in zip(g.axes, g.col_names):\n", + " labels = ax.get_xticks()\n", + " ax.set_xlabel('')\n", + " ax.set_xticklabels(labels, rotation=90)\n", + " plot_title = '\\n'.join(wrap(str(cname), 30))\n", + " ax.set_title(plot_title)\n", + "\n", + " # we want to try to force `tight_layout()`, but if this \n", + " # raises a warning, we don't want the entire notebook to fail\n", + " with warnings.catch_warnings():\n", + " warnings.simplefilter('ignore')\n", + " plt.tight_layout(h_pad=1.0)\n", "\n", - " imgfile = join(figure_dir, '{}_distrib.svg'.format(experiment_id))\n", - " plt.savefig(imgfile)\n", - " if use_thumbnails:\n", - " show_thumbnail(imgfile, next(id_generator))\n", - " else:\n", - " plt.show()" + " imgfile = join(figure_dir, '{}_distrib.svg'.format(experiment_id))\n", + " plt.savefig(imgfile)\n", + " if use_thumbnails:\n", + " show_thumbnail(imgfile, next(id_generator))\n", + " else:\n", + " plt.show()" ] }, { @@ -338,7 +333,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.7.6" } }, "nbformat": 4,