Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.
424 Discussions

scikit-learn test errors under Intel Python

sergio_r_
Novice
2,156 Views

 

Testing scikit-learn via the Intel Python gives many errors, shown below. The test can be run using:

nosetests -v sklearn

What this errors means in terms of using this package under Intel Python?

Regards,

Sergio
Enhance your #MachineLearning and #BigData skills via #Python #SciPy
1) https://www.packtpub.com/big-data-and-business-intelligence/numerical-and-sci
entific-computing-scipy-video
2) https://www.packtpub.com/big-data-and-business-intelligence/learning-scipy-nu
merical-and-scientific-computing-second-edition

======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_estimators_pickle(LinearRegression)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 355, in wrapper
    return fn(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 889, in check_estimators_pickle
    pickled_estimator = pickle.dumps(estimator)
TypeError: can't pickle SwigPyObject objects

======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_fit2d_predict1d(LinearRegression)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 479, in check_fit2d_predict1d
    getattr(estimator, method), X[0])
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 186, in assert_warns
    result = func(*args, **kw)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/daal4sklear
n/linear.py", line 156, in predict
    return daal_predict(self, X)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/daal4sklear
n/linear.py", line 56, in daal_predict
    predictionResult = algorithm.compute()
  File "/home/intel/intelpython3/lib/python3.5/site-packages/daal/algorithms/lin
ear_regression/prediction.py", line 253, in compute
    return _prediction9.Batch_Float64DefaultDense_compute(self)
SystemError: Number of columns in numeric table is incorrect
Details:
Argument name: beta


======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_estimators_pickle(RANSACRegressor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 355, in wrapper
    return fn(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 889, in check_estimators_pickle
    pickled_estimator = pickle.dumps(estimator)
TypeError: can't pickle SwigPyObject objects

======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_supervised_y_2d(RANSACRegressor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 355, in wrapper
    return fn(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 1151, in check_supervised_y_2d
    estimator.fit(X, y[:, np.newaxis])
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/linear_mode
l/ransac.py", line 363, in fit
    self.residual_threshold))
ValueError: No inliers found, possible cause is setting residual_threshold (None
) too low.

======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_fit2d_predict1d(RANSACRegressor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 479, in check_fit2d_predict1d
    getattr(estimator, method), X[0])
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 186, in assert_warns
    result = func(*args, **kw)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/linear_mode
l/ransac.py", line 428, in predict
    return self.estimator_.predict(X)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/daal4sklear
n/linear.py", line 156, in predict
    return daal_predict(self, X)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/daal4sklear
n/linear.py", line 56, in daal_predict
    predictionResult = algorithm.compute()
  File "/home/intel/intelpython3/lib/python3.5/site-packages/daal/algorithms/lin
ear_regression/prediction.py", line 253, in compute
    return _prediction9.Batch_Float64DefaultDense_compute(self)
SystemError: Number of columns in numeric table is incorrect
Details:
Argument name: beta


======================================================================
ERROR: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_c
ommon.py.test_non_meta_estimators:check_estimators_pickle(Ridge)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 355, in wrapper
    return fn(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 889, in check_estimators_pickle
    pickled_estimator = pickle.dumps(estimator)
TypeError: can't pickle SwigPyObject objects

======================================================================
FAIL: sklearn.cluster.tests.test_bicluster.test_project_and_cluster
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/cluster/tes
ts/test_bicluster.py", line 207, in test_project_and_cluster
    assert_array_equal(labels, [0, 0, 1, 1])
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 813, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 100.0%)
 x: array([1, 1, 0, 0], dtype=int32)
 y: array([0, 0, 1, 1])

======================================================================
FAIL: sklearn.cluster.tests.test_k_means.test_k_means_non_collapsed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/cluster/tes
ts/test_k_means.py", line 552, in test_k_means_non_collapsed
    assert_equal(len(np.unique(km.labels_)), 3)
AssertionError: 1 != 3

======================================================================
FAIL: sklearn.linear_model.tests.test_ridge.test_dense_sparse(<function _test_ri
dge_loo at 0x7fb59bd21840>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/linear_mode
l/tests/test_ridge.py", line 454, in check_dense_sparse
    ret_dense = test_func(DENSE_FILTER)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/linear_mode
l/tests/test_ridge.py", line 329, in _test_ridge_loo
    assert_almost_equal(errors, errors2)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 523, in assert_almost_equal
    return assert_array_almost_equal(actual, desired, decimal, err_msg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 918, in assert_array_almost_equal
    precision=decimal)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 7 decimals

(mismatch 100.0%)
 x: array([  1.8295168e+04,   5.6704414e+02,   1.1782287e+03,   5.2810053e+03,
         3.8443835e+02,   8.0439421e+03,   2.3982367e+03,   3.3362619e+03,
         1.1783452e+01,   5.1091672e+03,   1.3139571e+04,   1.5552388e+01,...
 y: array([  1.8505354e+04,   6.0452467e+02,   1.1257434e+03,   5.1693552e+03,
         4.1556914e+02,   8.1834151e+03,   2.4742189e+03,   3.4259267e+03,
         1.7722638e+01,   4.9988370e+03,   1.3318625e+04,   1.0045693e+01,...

======================================================================
FAIL: sklearn.manifold.tests.test_spectral_embedding.test_pipeline_spectral_clus
tering
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/manifold/te
sts/test_spectral_embedding.py", line 198, in test_pipeline_spectral_clustering
    true_labels), 1.0, 2)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 918, in assert_array_almost_equal
    precision=decimal)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals

(mismatch 100.0%)
 x: array(0.5866188259941206)
 y: array(1.0)

======================================================================
FAIL: sklearn.mixture.tests.test_dpgmm.test_class_weights
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 355, in wrapper
    return fn(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/mixture/tes
ts/test_dpgmm.py", line 41, in test_class_weights
    assert_array_less(dpgmm.weights_[~active], .05)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 990, in assert_array_less
    header='Arrays are not less-ordered')
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not less-ordered

(mismatch 14.285714285714292%)
 x: array([ 0.227048,  0.035354,  0.034998,  0.03491 ,  0.034875,  0.034874,
        0.034887])
 y: array(0.05)

======================================================================
FAIL: sklearn.model_selection.tests.test_validation.test_cross_val_score_with_sc
ore_func_regression
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/model_selec
tion/tests/test_validation.py", line 418, in test_cross_val_score_with_score_fun
c_regression
    assert_array_almost_equal(neg_mse_scores, expected_neg_mse, 2)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 918, in assert_array_almost_equal
    precision=decimal)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals

(mismatch 100.0%)
 x: array([ -760.52,  -514.85,  -265.83,  -275.24, -1647.  ])
 y: array([ -763.07,  -553.16,  -274.38,  -273.26, -1681.99])

======================================================================
FAIL: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_co
mmon.py.test_non_meta_estimators:check_estimators_nan_inf(LinearRegression)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 840, in check_estimators_nan_inf
    raise AssertionError(error_string_predict, Estimator)
AssertionError: ("Estimator doesn't check for NaN and inf in predict.", <class '
sklearn.linear_model.base.LinearRegression'>)

======================================================================
FAIL: /home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_co
mmon.py.test_non_meta_estimators:check_estimators_nan_inf(RANSACRegressor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/testi
ng.py", line 830, in __call__
    return self.check(*args, **kwargs)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/utils/estim
ator_checks.py", line 840, in check_estimators_nan_inf
    raise AssertionError(error_string_predict, Estimator)
AssertionError: ("Estimator doesn't check for NaN and inf in predict.", <class '
sklearn.linear_model.ransac.RANSACRegressor'>)

======================================================================
FAIL: sklearn.tests.test_cross_validation.test_cross_val_score_with_score_func_r
egression
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/intel/intelpython3/lib/python3.5/site-packages/nose/case.py", line
 198, in runTest
    self.test(*self.arg)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/sklearn/tests/test_
cross_validation.py", line 918, in test_cross_val_score_with_score_func_regressi
on
    assert_array_almost_equal(neg_mse_scores, expected_neg_mse, 2)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 918, in assert_array_almost_equal
    precision=decimal)
  File "/home/intel/intelpython3/lib/python3.5/site-packages/numpy/testing/utils
.py", line 739, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 2 decimals

(mismatch 100.0%)
 x: array([ -760.52,  -514.85,  -265.83,  -275.24, -1647.  ])
 y: array([ -763.07,  -553.16,  -274.38,  -273.26, -1681.99])

----------------------------------------------------------------------
Ran 7166 tests in 203.755s

FAILED (SKIP=14, errors=6, failures=9)

 

 

0 Kudos
24 Replies
sergio_r_
Novice
359 Views

Denis Nagorny (Intel) wrote:

Hi Gastón, 

It seems that kmeans could be already available on our channel.

You can try to use 'conda update -c intel scikit-learn'

Denis.

 

Hi Dennis,

 After performing the update, the "nosetests -v sklearn" does not work. Was it disable?

Sergio

0 Kudos
gaston-hillar
Valued Contributor I
359 Views

Sergio,

I think it would be a good idea to open a new forum topic with the nosetests issue in the new version.

0 Kudos
sergio_r_
Novice
359 Views

gaston-hillar wrote:

Sergio,

I think it would be a good idea to open a new forum topic with the nosetests issue in the new version.

 

Hi Gastón,

 Not to worry. I am pretty sure Intel developers are aware of this issue.  At some point they will
turn on the "nosetests -v sklearn" test again in their Python distribution. In any case, the Python Anaconda distribution has it on.


Regards,

Sergio
Enhance your #MachineLearning and #BigData skills via #Python #SciPy
1) https://www.packtpub.com/big-data-and-business-intelligence/numerical-and-scientific-computing-scipy-video
2) https://www.packtpub.com/big-data-and-business-intelligence/learning-scipy-numerical-and-scientific-computing-second-edition

 

 

0 Kudos
gaston-hillar
Valued Contributor I
359 Views

Sergio,

Thanks for sharing this info. I really appreciate the time you take to provide updates whenever you know the answer.

0 Kudos
Reply