Eliminating warnings from scikit-learn
Full error message
I would like to ignore warnings from all packages when I am teaching, but scikit-learn seems to work around the use of the warnings package to control this. For example:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from sklearn import preprocessing
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:66: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
if 'order' in inspect.getargspec(np.copy)[0]:
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:358: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
if 'exist_ok' in inspect.getargspec(os.makedirs).args:
Am I using this module incorrectly, or is sklearn doing something its not supposed to?Solutionsource: stackoverflow \u2197
It annoys me to the extreme that sklearn forces warnings. I started using this at the top of main.py: def warn(*args, **kwargs): pass import warnings warnings.warn = warn #... import sklearn stuff...
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/c33081e408b4731db0e04b51eb2caad5bf2fc8eb809d3eef036fbd0795827b01hash \u00b7 c33081e408b4731db0e04b51eb2caad5bf2fc8eb809d3eef036fbd0795827b01