[scikit-learn] How to test on PYTHON_ARCH=32 with mac?

Matthew Brett matthew.brett at gmail.com
Wed Jul 20 12:55:54 EDT 2016


On Wed, Jul 20, 2016 at 5:25 PM, lin yenchen <yenchenlin1994 at gmail.com> wrote:
> Thanks for you guys' precious inputs.
>
> I've successfully built a 32-bit python version scikit-learn and check it by
> printing `sys.maxint`,
> and all the tests passed on my mac. (I'm running the newest dev version
> though)

On current master I get the following failures from:

arch -i386 nosetests sklearn


```
======================================================================
ERROR: sklearn.decomposition.tests.test_nmf.test_non_negative_factorization_checking
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/utils/testing.py",
line 342, in wrapper
    return fn(*args, **kwargs)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/decomposition/tests/test_nmf.py",
line 237, in test_non_negative_factorization_checking
    assert_no_warnings(nnmf, A, A, A, np.int64(1))
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/utils/testing.py",
line 272, in assert_no_warnings
    result = func(*args, **kw)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/decomposition/nmf.py",
line 751, in non_negative_factorization
    " got (n_components=%r)" % n_components)
ValueError: Number of components must be a positive integer; got
(n_components=1)

======================================================================
ERROR: Test that it gives proper exception on deficient input.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/ensemble/tests/test_iforest.py",
line 107, in test_iforest_error
    assert_no_warnings(IsolationForest(max_samples=np.int64(2)).fit, X)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/utils/testing.py",
line 272, in assert_no_warnings
    result = func(*args, **kw)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/ensemble/iforest.py",
line 182, in fit
    raise ValueError("max_samples must be in (0, 1]")
ValueError: max_samples must be in (0, 1]

======================================================================
ERROR: sklearn.linear_model.tests.test_huber.test_huber_better_r2_score
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/linear_model/tests/test_huber.py",
line 170, in test_huber_better_r2_score
    huber_score = huber.score(X[mask], y[mask])
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/base.py", line 363, in score
    return r2_score(y, self.predict(X), sample_weight=sample_weight,
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/linear_model/base.py",
line 268, in predict
    return self._decision_function(X)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/linear_model/base.py",
line 251, in _decision_function
    X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/utils/validation.py",
line 415, in check_array
    context))
ValueError: Found array with 0 sample(s) (shape=(0, 20)) while a
minimum of 1 is required.

======================================================================
ERROR: sklearn.tree.tests.test_tree.test_huge_allocations
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/tree/tests/test_tree.py",
line 1089, in test_huge_allocations
    assert_raises(MemoryError, clf.fit, X, y)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py",
line 473, in assertRaises
    callableObj(*args, **kwargs)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/tree/tree.py",
line 366, in fit
    max_leaf_nodes)
  File "sklearn/tree/_tree.pyx", line 292, in
sklearn.tree._tree.BestFirstTreeBuilder.__cinit__
(sklearn/tree/_tree.c:4728)
    SIZE_t max_depth, SIZE_t max_leaf_nodes):
OverflowError: Python int too large to convert to C long

======================================================================
FAIL: Test that outliers filtering is scaling independent.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/linear_model/tests/test_huber.py",
line 120, in test_huber_scaling_invariant
    assert_array_equal(n_outliers_mask_3, n_outliers_mask_1)
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/numpy/testing/utils.py",
line 719, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/numpy/testing/utils.py",
line 645, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 66.0%)
 x: array([ True, False, False,  True, False, False, False, False, False,
       False, False, False, False, False, False, False,  True,  True,
       False, False, False,  True,  True, False,  True,  True, False,...
 y: array([ True,  True,  True,  True,  True,  True,  True,  True,  True,
        True,  True,  True,  True,  True,  True,  True,  True,  True,
        True,  True,  True,  True,  True,  True,  True,  True,  True,...

======================================================================
FAIL: Test they should converge to same coefficients for same parameters
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py",
line 197, in runTest
    self.test(*self.arg)
  File "/Users/mb312/dev_trees/scikit-learn/sklearn/linear_model/tests/test_huber.py",
line 136, in test_huber_and_sgd_same_results
    assert_almost_equal(huber.scale_, 1.0, 3)
  File "/Users/mb312/.virtualenvs/test/lib/python2.7/site-packages/numpy/testing/utils.py",
line 468, in assert_almost_equal
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 3 decimals
 ACTUAL: 3.6103567932800094e-11
 DESIRED: 1.0
```

I wonder why our results are different?

Cheers,

Matthew


More information about the scikit-learn mailing list