The coming scikit-learn 0.20 will remove RandomizedPCA and cross_validation module and replace them with new modules. So we need add compatibility for the coming version of scikit-learn
Release history of scikit-learn
Running a tpot example with the latest scikit-learn (version 0.18)
Result would be the same with previous version of scikit-learn, but with 2 warning messages below when runing pipeline evaluation.
2 warning messages :
..\Anaconda3\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
..\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py:52: DeprecationWarning: Class RandomizedPCA is deprecated; RandomizedPCA was deprecated in 0.18 and will be removed in 0.20. Use PCA(svd_solver='randomized') instead. The new implementation DOES NOT store whiten components_. Apply transform to get them.
warnings.warn(msg, category=DeprecationWarning)
Add separate opinions of cross-validation and PCA based on the version of sciket-learn
@sahilshah1194 -- I think this will be another good one to take on. Shouldn't be too hard to switch over to sklearn's new model_selection module.
I fixed the model_selection references and PCA issues in this commit. Let me know if there remain any issues with sklearn compatibility.
Xgboost already added compatibility for latest version of scikit-learn a few days ago. So user will not get deprecation warning in TPOT if they use the latest Xgboost (or don't have it) . To now, there is no compatibility issue for TPOT 0.6.6. Cheers. We can close the issue.
Hello @rhiever, I am using sklearn 0.18 on Ubuntu 16.04:
sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning)
Hi @dhananjayksharma, I am using the
from sknn.mlp import Regressor, Layer, Classifier
for creating neural networks. I am pretty new on this stuff. So I wonder that deprecation going to effect to simple Neural Networks too?
```
nn = Classifier(
layers=[
Layer("Sigmoid", units=1),
Layer("Softmax")
],
learning_rate=0.02,
n_iter=500)
nn.fit(train_X, train_y)
results = nn.predict(test_X)
return results```
hi All,
I am facing issue while loading "from sklearn.model_selection import train_test_split"
Error:
sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Please let me know how to resolve it
Python version: 3.5 Anaconda
I think updating your scikit-learn should solve the issue. Try the command below:
pip install scikit-learn --upgrade
Hello,
Thanks for the response but i have already updated verison of scikit-learn,
Requirement already up-to-date: scikit-learn in \appdata\local\continuum\anaconda3\lib\site-packages
Hmm, it is weird.
This DeprecationWarning should show up due to from sklearn.cross_validation import train_test_split instead of from sklearn.model_selection import train_test_split. Could you please let me know the version of scikit-learn, tpot and xgboost in your environment?
@weixuanfu2016
This DeprecationWarning should show up due to from sklearn.cross_validation import train_test_split instead of from sklearn.model_selection import train_test_split.
Thank you. Your suggestion helped. No more warning. I have the following version.
Hi guys,
I have same problem, when I try to import xgboost:
import xgboost as xgb
I have this warning:
DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Any advice ?? help?
@JeremieGuez The issue may be caused by pip install xgboost since the version in pypi is not up-to-date (check this issue). For avoiding this warning message, you need reinstall xgboost via compiling it with source codes in its GitHub repo (check the Installation Guide).
@weixuanfu2016 Thank you for your answer but it's still not working.
I did pip uninstall xgboost and then follow Installation Guide.
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; make -j4
I should forgot something because now I have:
No module named 'xgboost' when I try to from xgboost import XGBRegressor
You may just build the xgboost but not install it as a python module. Roll down a little bit in the Installation Guide and you can find the command for installing xgboost as a python module (check this link)
Thank you !! :)
Hi guys,
I am trying to install xgboost on my mac (10.12.5) and after several attempts I did not succeed. I follow different tuto trying to modifi gcc variable by adding gcc-6 but I have the same problem.
So what I did:
I have the following error:
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/learner.o src/learner.cc >build/learner.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/logging.o src/logging.cc >build/logging.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/c_api/c_api.o src/c_api/c_api.cc >build/c_api/c_api.d
/usr/local/bin/g++ -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -msse2 -fPIC -DDISABLE_OPENMP -MM -MT build/c_api/c_api_error.o src/c_api/c_api_error.cc >build/c_api/c_api_error.d
/bin/sh: /usr/local/bin/g++: No such file or directory
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/learner.o] Error 127
make: *** Waiting for unfinished jobs....
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/logging.o] Error 127
make: *** [build/c_api/c_api.o] Error 127
/bin/sh: /usr/local/bin/g++: No such file or directory
make: *** [build/c_api/c_api_error.o] Error 127
My gcc version is:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I really need your help. For the moment I use pip install xgboost to use the library but I know it's not the right way to use this library.
Thank you for your help
ps: sorry if my english is not ok, i am not fluent
This is probably a better question to ask on the XGBoost repo. But my first thought is you should try installing XGBoost via Anaconda: conda install py-xgboost
If that doesn't work, I suggest filing an issue on the XGBoost repo.
thanks, i will also report on XGBoost repo. I don't use conda so I will be not abble to try your solution.
Thanks for your answer.
I have the same problem
C:\Python27\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning
The DeprecationWarning should be from the old version of xgboost. You may need rebuild the latest xgboost from source codes and then install xgboost python module, for solving this problem.
Check your gcc version. I solved my problem like that
from sklearn.cross_validation import KFold
C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\cross_validation.py:41: Depr
ecationWarning: This module was deprecated in version 0.18 in favor of the model
_selection module into which all the refactored classes and functions are moved.
Also note that the interface of the new CV iterators are different from that of
this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
What is your xgboost version? @vishnupriyayetukuri
0.7 xgboost
hmm, I just found from sklearn.cross_validation import KFold in codes. I think it should be updated to from sklearn.model_selection import KFold
PLS HELP ME WITH THIS ERRORS
Traceback (most recent call last):
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask\app.py", line 1982, in
wsgi_app
response = self.full_dispatch_request()
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask\app.py", line 1614, in
full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask\app.py", line 1517, in
handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask_compat.py", line 33,
in reraise
raise value
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask\app.py", line 1612, in
full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\DELLPC\Anaconda3\lib\site-packagesflask\app.py", line 1598, in
dispatch_request
return self.view_functionsrule.endpoint
File "app.py", line 192, in cancerClassifier
prediction=model.predict(X_test)
File "C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\ensembleforest.py",
line 538, in predict
proba = self.predict_proba(X)
File "C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\ensembleforest.py",
line 578, in predict_proba
X = self._validate_X_predict(X)
File "C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\ensembleforest.py",
line 357, in _validate_X_predict
return self.estimators_[0]._validate_X_predict(X, check_input=True)
File "C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\tree\tree.py", line
373, in _validate_X_predict
X = check_array(X, dtype=DTYPE, accept_sparse="csr")
File "C:\Users\DELLPC\Anaconda3\lib\site-packages\sklearn\utils\validation.py"
, line 441, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[15.2 52. 28. 20. 5. ].
Reshape your data either using array.reshape(-1, 1) if your data has a single fe
ature or array.reshape(1, -1) if it contains a single sample.
I think the error message is clear and you may need reshape your input X. And also I think this should be a issue in scikit-learn鈥檚 repo. Unless please provide codes about tpot to reproduce it.
I think
from sklearn.model_selection import train_test_split
is going to work out..........
C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\python.exe "D:/NetOps GNS/Python/datasetocr01.py"
C:\Users\ana2\AppData\Roaming\Python\Python36\site-packages\sklearn\utils\deprecation.py:77: DeprecationWarning: Function fetch_mldata is deprecated; fetch_mldata was deprecated in version 0.20 and will be removed in version 0.22
warnings.warn(msg, category=DeprecationWarning)
C:\Users\ana2\AppData\Roaming\Python\Python36\site-packages\sklearn\utils\deprecation.py:77: DeprecationWarning: Function mldata_filename is deprecated; mldata_filename was deprecated in version 0.20 and will be removed in version 0.22
warnings.warn(msg, category=DeprecationWarning)
Traceback (most recent call last):
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 964, in send
self.connect()
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\socket.py", line 704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/NetOps GNS/Python/datasetocr01.py", line 9, in
mnist=fetch_mldata('MNIST original')
File "C:\Users\ana2\AppData\Roaming\Python\Python36\site-packages\sklearn\utils\deprecation.py", line 78, in wrapped
return fun(args, *kwargs)
File "C:\Users\ana2\AppData\Roaming\Python\Python36\site-packages\sklearndatasets\mldata.py", line 133, in fetch_mldata
mldata_url = urlopen(urlname)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\ana2\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError:
Process finished with exit code 1
@hammadattari Could you provide codes for reproducing this issue?
Most helpful comment
Hmm, it is weird.
This DeprecationWarning should show up due to
from sklearn.cross_validation import train_test_splitinstead offrom sklearn.model_selection import train_test_split. Could you please let me know the version of scikit-learn, tpot and xgboost in your environment?