【问题标题】:Failed testing on Ubuntu 12.04在 Ubuntu 12.04 上测试失败
【发布时间】:2014-04-25 04:04:09
【问题描述】:

通过'sodu python setup.py install'从0.14.1版本的源代码安装scikit-learn后,我通过'nosetests sklearn --exe'测试了这个包,得到如下信息:

==================================================================================
/home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/feature_selection/selector_mixin.py:7: DeprecationWarning: sklearn.feature_selection.selector_mixin.SelectorMixin has been renamed sklearn.feature_selection.from_model._LearntSelectorMixin, and this alias will be removed in version 0.16
  DeprecationWarning)
/home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/pls.py:7: DeprecationWarning: This module has been moved to cross_decomposition and will be removed in 0.16
  "removed in 0.16", DeprecationWarning)
.......S................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/cluster/hierarchical.py:746: DeprecationWarning: The Ward class is deprecated since 0.14 and will be removed in 0.17. Use the AgglomerativeClustering instead.
  "instead.", DeprecationWarning)
.........../usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1423: UserWarning: 
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
.............................................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/manifold/spectral_embedding_.py:226: UserWarning: Graph is not fully connected, spectral embedding may not work as expected.
  warnings.warn("Graph is not fully connected, spectral embedding"
..................................SS..............S.................................................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/utils/extmath.py:83: NonBLASDotWarning: Data must be of same type. Supported types are 32 and 64 bit float. Falling back to np.dot.
  'Falling back to np.dot.', NonBLASDotWarning)
....................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/decomposition/fastica_.py:271: UserWarning: Ignoring n_components with whiten=False.
  warnings.warn('Ignoring n_components with whiten=False.')
..................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/utils/extmath.py:83: NonBLASDotWarning: Data must be of same type. Supported types are 32 and 64 bit float. Falling back to np.dot.
  'Falling back to np.dot.', NonBLASDotWarning)
....................................S................................../home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/externals/joblib/test/test_func_inspect.py:134: UserWarning: Cannot inspect object <functools.partial object at 0xbdebf04>, ignore list will not work.
  nose.tools.assert_equal(filter_args(ff, ['y'], (1, )),

FAIL: Check that gini is equivalent to mse for binary output variable
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/elkan/Downloads/MS2PIP/scikit-learn/sklearn/tree/tests/test_tree.py", line 301, in test_importances_gini_equal_mse
    assert_almost_equal(clf.feature_importances_, reg.feature_importances_)
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 452, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 800, in assert_array_almost_equal
    header=('Arrays are not almost equal to %d decimals' % decimal))
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 636, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 7 decimals

(mismatch 70.0%)
 x: array([ 0.2925143 ,  0.27676187,  0.18835709,  0.04181255,  0.03699054,
        0.01668818,  0.03661717,  0.03439216,  0.04422749,  0.03163866])
 y: array([ 0.29599052,  0.27676187,  0.19146823,  0.03837769,  0.03699054,
        0.01811955,  0.0362238 ,  0.03439216,  0.04137032,  0.03030531])
>>  raise AssertionError('\nArrays are not almost equal to 7 decimals\n\n(mismatch 70.0%)\n x: array([ 0.2925143 ,  0.27676187,  0.18835709,  0.04181255,  0.03699054,\n        0.01668818,  0.03661717,  0.03439216,  0.04422749,  0.03163866])\n y: array([ 0.29599052,  0.27676187,  0.19146823,  0.03837769,  0.03699054,\n        0.01811955,  0.0362238 ,  0.03439216,  0.04137032,  0.03030531])')


----------------------------------------------------------------------
Ran 3950 tests in 150.890s

FAILED (SKIP=19, failures=1)


==================================================================================

python 版本为 2.7.3,操作系统为 32 位。 那么,问题可能出在哪里?

谢谢。

【问题讨论】:

    标签: python-2.7 ubuntu scikit-learn


    【解决方案1】:

    这是 32 位平台上的数值精度差异。您可以放心地忽略它,因为失败的测试是检查随机森林的属性clf.feature_importances_ 的值,通常不需要精确才能有用(解释对 RF 模型有贡献的最重要特征)。

    【讨论】:

    • 在 0.14.1 中,选择拆分时检测要跳过的连续特征的阈值可能取决于平台。在 master 中应该不再是这种情况。
    猜你喜欢
    • 1970-01-01
    • 2013-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 2015-07-27
    相关资源
    最近更新 更多