鼻子python27和sklearn

时间:2014-01-10 01:34:43

标签: python scikit-learn nosetests

我使用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目录运行nosetests时,不确定为什么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-package / 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 / Cluster.framework / Version / 1.7 / lib / python2.7','/ opt / local / Library / Frameworks / Python .framework / Versions / 2.7 / lib / python2.7 / plat-darwin','/ opt / local / Library / Frame /Python.framework / Version / 7.7 / lib / python2.7 / plan -mac','/ opt /local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages','/ opt / local / Library / Frameworks / Python.framework / Version / 2.7 / lib / python2.7 / lib-tk','/ opt / local / Library / Frameworks / Python.framework / Version / 1.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 / Version / 7.7 / lib / python2.7 / site-packages','/ Library /Python/2.7/site-packages']“

1 个答案:

答案 0 :(得分:1)

在此特定测试中看起来像数值稳定性问题。除非你特别感兴趣在该平台上使用双聚类模型,否则我不会对此持谨慎态度。

您还可以尝试构建当前的scikit主 - 从git中学习。自上次发布以来,该测试可能已经稳定(虽然我不是100%肯定)。