Failed testing on Ubuntu 12.04
Question: After installing the scikit-learn from source code of version 0.14.1 by 'sodu
python setup.py install', I tested the package by 'nosetests sklearn --exe',
and received the following information:

    
    
    ==================================================================================
    /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)
    
    
    ==================================================================================
    

The python version is 2.7.3, OS is 32 bit. So, what the problem might be?

Thanks.


Answer: It's a numerical precision discrepancy on 32 bit platforms. You can safely
ignore it as the failing test is checking the values of the attribute
`clf.feature_importances_` of a random forest which usually do not need to be
precise to be useful (interpretation of the most important features
contributing to the RF model).

