使用train_test_split进行虹膜时收到输入形状错误。我不明白为什么。我测试了其他数据集。 train_test_split应该处理这个形状。有什么建议?感谢
Collecting fbprophet
Using cached fbprophet-0.1.post1.tar.gz
Complete output from command python setup.py egg_info:
no previously-included directories found matching 'doc\_build'
warning: no previously-included files matching '*.so' found anywhere in dist
ribution
warning: no previously-included files matching '*.pyc' found anywhere in dis
tribution
warning: no previously-included files matching '.git*' found anywhere in dis
tribution
warning: no previously-included files matching '*.png' found anywhere in dis
tribution
no previously-included directories found matching 'pystan\stan\make'
no previously-included directories found matching 'pystan\stan\src\docs'
no previously-included directories found matching 'pystan\stan\src\doxygen'
no previously-included directories found matching 'pystan\stan\src\python'
no previously-included directories found matching 'pystan\stan\src\test'
no previously-included directories found matching 'pystan\stan\lib\stan_math
\doxygen'
no previously-included directories found matching 'pystan\stan\lib\stan_math
\make'
no previously-included directories found matching 'pystan\stan\lib\stan_math
\test'
no previously-included directories found matching 'pystan\stan\lib\stan_math
\lib\cpplint_4.45'
no previously-included directories found matching 'pystan\stan\lib\stan_math
\lib\gtest_1.7.0'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\polest~1\appdata\local\temp\pip-build-rnvpe9\fbprophet\setu
p.py", line 96, in <module>
"""
File "C:\Users\PolestarEmployee\Anaconda2\lib\distutils\core.py", line 111
, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\dist.py", line 269, in __init__
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\dist.py", line 313, in fetch_build_eggs
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\pkg_resources\__init__.py", line 827, in resolve
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\pkg_resources\__init__.py", line 1072, in best_match
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\pkg_resources\__init__.py", line 1084, in obtain
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\dist.py", line 380, in fetch_build_egg
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\command\easy_install.py", line 640, in easy_install
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\command\easy_install.py", line 670, in install_item
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\command\easy_install.py", line 850, in install_eggs
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\command\easy_install.py", line 1078, in
build_and_install
File "C:\Users\PolestarEmployee\Anaconda2\lib\site-packages\setuptools-20.
3-py2.7.egg\setuptools\command\easy_install.py", line 1066, in run_setup
distutils.errors.DistutilsError: Setup script exited with error:
SandboxViol
ation: open('build\\lib.win-amd64-
2.7\\pystan\\stan\\lib\\stan_math_2.14.0\\doc\
\api\\html\\d0\\d0f\\
structstan_1_1is__vector__like_3_01_eigen_1_1_matrix_3_01_t
_00_01_eigen_1_1_dynamic_00_01_eigen_1_1_dynamic_01_4_01_4-members.html',
'wb')
{}
The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
答案 0 :(得分:0)
更改代码中的以下行,它应该有效!
Xtrain, Ytrain, Xtest, Ytest = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), test_size=0.4, train_size=0.6)
为:
Xtrain, Xtest, Ytrain, Ytest = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), test_size=0.4, train_size=0.6)
您接受的参数顺序不正确。请参阅:http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html