We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eadd3e1 commit f3951d4Copy full SHA for f3951d4
tests/test_xgboost.py
@@ -1,9 +1,9 @@
1
import unittest
2
3
+import numpy as np
4
import xgboost
5
6
from distutils.version import StrictVersion
-from sklearn import datasets
7
from xgboost import XGBClassifier
8
9
class TestXGBoost(unittest.TestCase):
@@ -12,8 +12,15 @@ def test_version(self):
12
self.assertGreaterEqual(StrictVersion(xgboost.__version__), StrictVersion("1.2.1"))
13
14
def test_classifier(self):
15
- boston = datasets.load_boston()
16
- X, y = boston.data, boston.target
+ X_train = np.random.random((100, 28))
+ y_train = np.random.randint(10, size=(100, 1))
17
+ X_test = np.random.random((100, 28))
18
+ y_test = np.random.randint(10, size=(100, 1))
19
- xgb1 = XGBClassifier(n_estimators=3)
- xgb1.fit(X[0:70],y[0:70])
20
+ xgb1 = XGBClassifier(n_estimators=3, use_label_encoder=False)
21
+ xgb1.fit(
22
+ X_train, y_train,
23
+ eval_set=[(X_train, y_train), (X_test, y_test)],
24
+ eval_metric='mlogloss',
25
+ )
26
+ self.assertIn("validation_0", xgb1.evals_result())
0 commit comments