Fix prediction with cat data in sklearn interface. (#7306)

* Specify DMatrix parameter for pre-processing dataframe.
* Add document about the behaviour of prediction.
This commit is contained in:
Jiaming Yuan
2021-10-12 14:31:12 +08:00
committed by GitHub
parent 89d87e5331
commit 5b17bb0031
2 changed files with 17 additions and 4 deletions

View File

@@ -59,6 +59,7 @@ def test_categorical():
)
X = pd.DataFrame(X.todense()).astype("category")
clf.fit(X, y)
assert not clf._can_use_inplace_predict()
with tempfile.TemporaryDirectory() as tempdir:
model = os.path.join(tempdir, "categorial.json")