Eliminating warnings from scikit-learn [duplicate] Eliminating warnings from scikit-learn [duplicate] python python

Eliminating warnings from scikit-learn [duplicate]


It annoys me to the extreme that sklearn forces warnings.

I started using this at the top of main.py:

def warn(*args, **kwargs):    passimport warningswarnings.warn = warn#... import sklearn stuff...


They have changed their warning policy in 2013. You can ignore warnings (also specific types) with something like this:

import warningswarnings.filterwarnings("ignore", category=DeprecationWarning)

//EDIT: in the comments below, Reed Richards points out that the filterwarnings call needs to be in the file that calls the function that gives the warning.I hope this helps those who experienced problems with this solution.