我期待使用pip安装hunspell软件包,但会引发以下错误:
Collecting hunspell
Using cached hunspell-0.4.1.tar.gz
Building wheels for collected packages: hunspell
Running setup.py bdist_wheel for hunspell ... error
Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmphqvqt4lxpip-wheel- --python-tag cp34:
/root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
warnings.warn(msg)
running bdist_wheel
running build
running build_ext
building 'hunspell' extension
creating build
creating build/temp.linux-x86_64-3.4
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
hunspell.c:21:22: erreur fatale: hunspell.h …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 xgboost 算法预测解决多类分类,但是我不知道它是如何predict_proba工作的。事实上,predict_proba生成一个概率列表,但我不知道每个概率与哪个类别相关。
这是一个简单的例子:
这是我的火车数据:
+------------+----------+-------+
| feature1 | feature2 | label |
+------------+----------+-------+
| x | z | 3 |
+------------+----------+-------+
| y | u | 0 |
+------------+----------+-------+
| x | u | 2 |
+------------+----------+-------+
Run Code Online (Sandbox Code Playgroud)
然后当我尝试预测新示例的概率时
model.predict_proba(['x','u'])
Run Code Online (Sandbox Code Playgroud)
这将返回如下内容:
[0.2, 0.3, 0.5]
Run Code Online (Sandbox Code Playgroud)
我的问题是:概率为 0.5 的类是什么?是 2 级、3 级还是 0 级?
我有一个DataFrame看起来像这样:
+--------------------+------------------+
| features| labels |
+--------------------+------------------+
|[-0.38475, 0.568...]| label1 |
|[0.645734, 0.699...]| label2 |
| ..... | ... |
+--------------------+------------------+
Run Code Online (Sandbox Code Playgroud)
两列都是String类型(StringType()),我想把它装入spark ml randomForest.为此,我需要将features列转换为包含浮点数的向量.有没有人知道怎么做?