I'm trying to run this python script below:
import pandas as pdfrom sklearn.model_selection import train_test_splitfrom sklearn.ensemble import RandomForestClassifierfrom sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
It gives me the error below.
Warning (from warnings module): File "C:\Users\Dipali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 29 from numpy.core.umath_tests import inner1d DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
What I need to do?
You can ignore warning following ways like below
Example1:
#!/usr/bin/env python -W ignore::DeprecationWarning
Example2:
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
Example 3:
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
Alright so this is a deprecation warning on Python 3.x.
Since, this is warning your code will run fine. It is not an error (When the code stops running by graceful degradation).
The solution to remove this error is as follow:
0.19.2 installed you need to get the latest version. To do so enter the following command pip3 install --force-reinstall scikit-learn==0.20rc1 \sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py. sudo idle3 onto the file and edit the lines which says : import imp from imp import find_module import importlib find_module and change the line file, path, description = find_module(path) file, path, description = importlib.utils.find_spec(path).This must solve the deprecation warnings in the scikit-learn libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With