Commit db8b6b00 authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

[python] fixed sklearn test on python 2.7 (#888)

* fixed sklearn test on python 2.7

* commit to show that problem has been solved

* come back to python 3.6

* removed warnings check
parent 015c8fff
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
import math import math
import os import os
import unittest import unittest
import warnings
import lightgbm as lgb import lightgbm as lgb
import numpy as np import numpy as np
...@@ -174,13 +173,6 @@ class TestSklearn(unittest.TestCase): ...@@ -174,13 +173,6 @@ class TestSklearn(unittest.TestCase):
y_pred_2 = clf_2.fit(X_train, y_train).predict_proba(X_test) y_pred_2 = clf_2.fit(X_train, y_train).predict_proba(X_test)
np.testing.assert_allclose(y_pred_1, y_pred_2) np.testing.assert_allclose(y_pred_1, y_pred_2)
# Tests that warnings were raised
with warnings.catch_warnings(record=True) as w:
clf_1.get_params()
clf_2.set_params(nthread=-1).fit(X_train, y_train)
self.assertEqual(len(w), 2)
self.assertTrue(issubclass(w[-1].category, Warning))
def test_sklearn_integration(self): def test_sklearn_integration(self):
# we cannot use `check_estimator` directly since there is no skip test mechanism # we cannot use `check_estimator` directly since there is no skip test mechanism
for name, estimator in ((lgb.sklearn.LGBMClassifier.__name__, lgb.sklearn.LGBMClassifier), for name, estimator in ((lgb.sklearn.LGBMClassifier.__name__, lgb.sklearn.LGBMClassifier),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment