【问题标题】:nose python27 and sklearn鼻子 python27 和 sklearn
【发布时间】:2014-01-28 20:34:26
【问题描述】:

我已经使用 MacPorts 安装了 python27,并将 /opt/local/bin 路径添加到 PATH 变量中。当我执行which python 时,我会在/opt/local/bin 安装一个,这很好。但是,我使用easy_install 安装了nose,并且nosetests 现在安装在/usr/local/bin 中。 /opt/local/bin 中也有一个nosetests-2.7。我试过运行那个:

/opt/local/bin/nosetests-2.7  --exe sklearn 

但是,经过一堆警告和成功的测试,我最终得到以下结果:

ERROR: sklearn.cluster.bicluster.tests.test_utils.test_get_submatrix
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose-1.3.0-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/cluster/bicluster/tests/test_utils.py", line 43, in test_get_submatrix
    assert_true(np.all(X != -1))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 422, in assertTrue
    if not expr:
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/base.py", line 183, in __bool__
    raise ValueError("The truth value of an array with more than one "
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().

----------------------------------------------------------------------
Ran 1715 tests in 112.607s

FAILED (SKIP=16, errors=1)

当我清楚地从 /opt/local/bin 目录运行鼻子测试时,不确定为什么要执行 File "/Library/Python/2.7/site-packages/nose-1.3.0-py2.7.egg/nose/case.py"

对此的任何帮助将不胜感激!

更新:

结果:python -c 'import sys; print(sys.path)'

"['', '/Library/Python/2.7/site-packages/nose-1.3.0-py2.7.egg', '/Library/Python/2.7/site-packages/Theano-0.6.0 -py2.7.egg', '/Library/Python/2.7/site-packages/scipy-0.13.2-py2.7-macosx-10.8-intel.egg', '/opt/local/Library/Frameworks/Python .framework/Versions/2.7/lib/python27.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/opt/local/Library/Frameworks/Python .framework/Versions/2.7/lib/python2.7/plat-darwin', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/opt /local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/ python2.7/lib-tk','/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old','/opt/local/Library/Frameworks/Python. framework/Versions/2.7/lib/python2.7/lib-dynload', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library /Python/2.7/site-packages']"

【问题讨论】:

  • python -c 'import sys; print(sys.path)' 说什么?
  • 在问题中添加了命令的结果!

标签: python scikit-learn nosetests


【解决方案1】:

在这个特定的测试中,它看起来像是一个数值稳定性问题。除非您对在该平台上使用双聚类模型特别感兴趣,否则我不会对此过于谨慎。

您也可以尝试从 git 构建当前的 scikit-learn 大师。自上次发布以来,此测试可能已经稳定(尽管我不是 100% 确定)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-18
    • 1970-01-01
    • 1970-01-01
    • 2015-12-18
    • 1970-01-01
    相关资源
    最近更新 更多