Python scikit-learn 和 sklearn 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38733220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between scikit-learn and sklearn
提问by Barry
On OS X 10.11.6 and python 2.7.10 I need to import from sklearn manifold.
I have numpy 1.8 Orc1, scipy .13 Ob1 and scikit-learn 0.17.1 installed.
I used pip to install sklearn(0.0), but when I try to import from sklearn manifold I get the following:
在 OS X 10.11.6 和 python 2.7.10 上,我需要从 sklearn 流形导入。我安装了 numpy 1.8 Orc1、scipy .13 Ob1 和 scikit-learn 0.17.1。
我使用 pip 安装 sklearn(0.0),但是当我尝试从 sklearn 流形导入时,我得到以下信息:
Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/sklearn/init.py", line 57, in from .base import clone File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in from .utils.fixes import signature File "/Library/Python/2.7/site-packages/sklearn/utils/init.py", line 10, in from .murmurhash import murmurhash3_32 File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029) ValueError: numpy.dtype has the wrong size, try recompiling.
回溯(最近通话最后一个):文件“”,1号线,在文件“/Library/Python/2.7/site-packages/sklearn/初始化py”为57行,从.base进口克隆文件“/库/的Python / 2.7 /站点包/ sklearn / base.py”,第11行,从.utils.fixes进口签名文件“/Library/Python/2.7/site-packages/sklearn/utils/初始化的.py”,10号线, in from .murmurhash import murmurhash3_32 File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029) ValueError: numpy.dtype has the wrong size, 尝试重新编译。
What is the difference between scikit-learn and sklearn? Also, I cant import scikit-learn because of a syntax error
scikit-learn 和 sklearn 有什么区别?另外,由于语法错误,我无法导入 scikit-learn
回答by Vinay87
You might need to reinstall numpy. It doesn't seem to have installed correctly.
您可能需要重新安装 numpy。它似乎没有正确安装。
sklearn
is how you type the scikit-learn name in python.
sklearn
是你在 python 中输入 scikit-learn 名称的方式。
Also, try running the standard tests in scikit-learn and check the output. You will have detailed error information there.
此外,尝试在 scikit-learn 中运行标准测试并检查输出。您将在那里获得详细的错误信息。
Do you have nosetests
installed? Try: nosetests -v sklearn
. You type this in bash, not in the python interpreter.
你nosetests
安装了吗?试试:nosetests -v sklearn
。你在 bash 中输入这个,而不是在 python 解释器中。
回答by Melkor.cz
Regarding the difference sklearn vs. scikit-learn:
The package "scikit-learn"is recommended to be installed using pip install scikit-learn
but in your code imported using import sklearn
.
关于 sklearn 与 scikit-learn 的区别:建议使用安装包“scikit-learn”,pip install scikit-learn
但在使用import sklearn
.
A bit confusing, because you can also do pip install sklearn
and will end up with the same scikit-learn package installed, because there is a "dummy" pypi package sklearnwhich will install scikit-learn for you.
有点令人困惑,因为您也可以这样做pip install sklearn
并且最终会安装相同的 scikit-learn 包,因为有一个“虚拟” pypi 包 sklearn将为您安装 scikit-learn。
From this thread:
从这个线程:
scikit-learn is in install_requires of sklearn setup.py so you do end-up with scikit-learn installed
scikit-learn 位于 sklearn setup.py 的 install_requires 中,因此您最终安装了 scikit-learn
So:
所以:
At the end,
pip install sklearn
orpip install scikit-learn
--- apart from the annoyingsklearn (0.0)
showed in thepip list
--- will install the latest available build from PyPI.
最后,
pip install sklearn
或者pip install scikit-learn
--- 除了 --- 中sklearn (0.0)
显示的烦人之外,pip list
将从 PyPI 安装最新的可用构建。