Categorical data support for cuDF. (#7042)

* Add support in DMatrix.
* Add support in DQM, except for iterator.
This commit is contained in:
Jiaming Yuan
2021-06-17 13:54:33 +08:00
committed by GitHub
parent 5c2d7a18c9
commit d9799b09d0
5 changed files with 129 additions and 106 deletions

View File

@@ -43,22 +43,8 @@ class TestGPUUpdaters:
assert tm.non_increasing(result['train'][dataset.metric])
def run_categorical_basic(self, rows, cols, rounds, cats):
import pandas as pd
rng = np.random.RandomState(1994)
pd_dict = {}
for i in range(cols):
c = rng.randint(low=0, high=cats+1, size=rows)
pd_dict[str(i)] = pd.Series(c, dtype=np.int64)
df = pd.DataFrame(pd_dict)
label = df.iloc[:, 0]
for i in range(0, cols-1):
label += df.iloc[:, i]
label += 1
df = df.astype('category')
onehot = pd.get_dummies(df)
cat = df
onehot, label = tm.make_categorical(rows, cols, cats, True)
cat, _ = tm.make_categorical(rows, cols, cats, False)
by_etl_results = {}
by_builtin_results = {}