[backport] Fix prediction with cat data in sklearn interface. (#7306) (#7312)

* Specify DMatrix parameter for pre-processing dataframe.
* Add document about the behaviour of prediction.
This commit is contained in:
Jiaming Yuan
2021-10-12 18:49:57 +08:00
committed by GitHub
parent 36e247aca4
commit 30c1b5c54c
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")