Skip to content Skip to sidebar Skip to footer

The Sklearn.tree.tree Module Is Deprecated In Version 0.22 And Will Be Removed In Version 0.24

I'm using the DecisionTreeClassifier from scikit-learn (https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html) and getting the following warnin

Solution 1:

  • You can ignore the deprecation warning, it's only a warning (I wouldn't worry if your code isn't referencing that subpackage, there's probably an import somewhere under the hood inside sklearn.)

  • You could suppress all FutureWarnings, but then you might miss another more important one, on sklearn or another package. So I'd just ignore it for now. But if you want to:

    import warnings
    warnings.simplefilter('ignore', FutureWarning)
    
    from sklearn.tree import ...
    
    # ... Then turn warnings back on for other packages
    warnings.filterwarnings('module') # or 'once', or 'always'

See the doc, or How to suppress Future warning from import?, although obviously you replace import pandas with your own import statement.

Solution 2:

link of the same kind of problem

It's just a warning, for now -- until you upgrade scikit/sklearn to version 0.24, You need to update your scikit/sklearn version.

Post a Comment for "The Sklearn.tree.tree Module Is Deprecated In Version 0.22 And Will Be Removed In Version 0.24"