8000 Get rid of warnings during tests · Issue #834 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Get rid of warnings during tests #834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GaelVaroquaux opened this issue May 6, 2012 · 0 comments
Closed

Get rid of warnings during tests #834

GaelVaroquaux opened this issue May 6, 2012 · 0 comments

Comments

@GaelVaroquaux
Copy link
Member

With numpy master, warnings during test (using NumpyTester) are treated as errors. This should encouraging us to get rid of these warnings during the tests (for instance by capturing them):

======================================================================
ERROR: sklearn.cluster.tests.test_k_means.test_kmeans_dtype
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/tests/test_k_means.py", line 51, in test_kmeans_dtype
    assert_array_equal(km.labels_, km.predict(X))
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/k_means_.py", line 785, in predict
    X = self._check_test_data(X)
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/k_means_.py", line 716, in _check_test_data
    RuntimeWarning, stacklevel=2)
RuntimeWarning: Got data type uint8, converted to float to avoid overflows

======================================================================
ERROR: sklearn.cluster.tests.test_k_means.test_minibatch_init_with_large_k
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/tests/test_k_means.py", line 243, in test_minibatch_init_with_large_k
    mb_k_means.fit(X)
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/k_means_.py", line 1110, in fit
    init_size=init_size)
  File "/home/varoquau/dev/scikit-learn/sklearn/cluster/k_means_.py", line 556, in _init_centroids
    RuntimeWarning, stacklevel=2)
RuntimeWarning: init_size=10 should be larger than k=20. Setting it to 3*k

======================================================================
ERROR: sklearn.feature_extraction.tests.test_text.test_tfidf_no_smoothing
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/feature_extraction/tests/test_text.py", line 264, in test_tfidf_no_smoothing
    tfidf = tr.fit_transform(X).toarray()
  File "/home/varoquau/dev/scikit-learn/sklearn/base.py", line 360, in fit_transform
    return self.fit(X, **fit_params).transform(X)
  File "/home/varoquau/dev/scikit-learn/sklearn/feature_extraction/text.py", line 580, in fit
    self.idf_ = np.log(float(n_samples) / df) + 1.0
RuntimeWarning: divide by zero encountered in divide

======================================================================
ERROR: Compute the Adjusted Mutual Information and test against known values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/metrics/cluster/tests/test_supervised.py", line 158, in test_adjusted_mutual_info_score
    ami = adjusted_mutual_info_score(a110, b110)
  File "/home/varoquau/dev/scikit-learn/sklearn/metrics/cluster/supervised.py", line 628, in adjusted_mutual_info_score
    emi = expected_mutual_information(contingency, n_samples)
  File "/home/varoquau/dev/scikit-learn/sklearn/metrics/cluster/supervised.py", line 678, in expected_mutual_information
    emi += (term1[nij] * term2 * term3)
RuntimeWarning: underflow encountered in double_scalars

======================================================================
ERROR: sklearn.svm.tests.test_svm.test_linearsvc_deepcopy
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/svm/tests/test_svm.py", line 608, in test_linearsvc_deepcopy
    copy.deepcopy(clf).predict(rng.rand(2))
  File "/home/varoquau/dev/scikit-learn/sklearn/svm/base.py", line 703, in predict
    X = self._validate_for_predict(X)
  File "/home/varoquau/dev/scikit-learn/sklearn/svm/base.py", line 761, in _validate_for_predict
    stacklevel=3)
RuntimeWarning: Coefficients are the fortran-contiguous. Copying them.

======================================================================
ERROR: sklearn.tests.test_cross_validation.test_shuffle_split_warnings
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/tests/test_cross_validation.py", line 173, in test_shuffle_split_warnings
    cval.ShuffleSplit(10, 3, test_fraction=0.1)
  File "/home/varoquau/dev/scikit-learn/sklearn/cross_validation.py", line 767, in __init__
    DeprecationWarning, stacklevel=2)
DeprecationWarning: test_fraction is deprecated in 0.11 and scheduled for removal in 0.12, use test_size instead

======================================================================
ERROR: sklearn.tests.test_multiclass.test_ecoc_fit_predict
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 187, in runTest
    self.test(*self.arg)
  File "/home/varoquau/dev/scikit-learn/sklearn/tests/test_multiclass.py", line 196, in test_ecoc_fit_predict
    ecoc.fit(iris.data, iris.target).predict(iris.data)
  File "/home/varoquau/dev/scikit-learn/sklearn/multiclass.py", line 431, in fit
    fit_ecoc(self.estimator, X, y, self.code_size, self.random_state)
  File "/home/varoquau/dev/scikit-learn/sklearn/multiclass.py", line 337, in fit_ecoc
    for i in range(Y.shape[1])]
  File "/home/varoquau/dev/scikit-learn/sklearn/multiclass.py", line 33, in _fit_binary
    estimator.fit(X, y)
  File "/home/varoquau/dev/scikit-learn/sklearn/naive_bayes.py", line 269, in fit
    self.class_log_prior_ = np.log(y_freq) - np.log(y_freq.sum())
RuntimeWarning: divide by zero encountered in log

----------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0