def test_drift_detector_split(self):
    df = cudf.from_pandas(load_bank())
    y = df.pop('y')
    (X_train, X_test) = CumlToolBox.train_test_split(df.copy(), train_size=0.7, shuffle=True, random_state=9527)
    dd = dd_selector().get_detector()
    dd.fit(X_train, X_test)
    assert (len(dd.feature_names_) == 17)
    assert (len(dd.feature_importances_) == 17)
    assert dd.auc_
    assert (len(dd.estimator_) == 5)
    proba = dd.predict_proba(df)
    assert (proba.shape[0] == df.shape[0])
    df = cudf.from_pandas(load_bank())
    y = df.pop('y')
    p = int((df.shape[0] * 0.2))
    (X_train, X_test, y_train, y_test) = dd.train_test_split(df.copy(), y, test_size=0.2)
    assert (X_train.shape == ((df.shape[0] - p), df.shape[1]))
    assert (y_train.shape == ((df.shape[0] - p),))
    assert (X_test.shape == (p, df.shape[1]))
    assert (y_test.shape == (p,))
    df['y'] = y
    X_train['y'] = y_train
    X_test['y'] = y_test
    (df, X_train, X_test) = CumlToolBox.to_local(df, X_train, X_test)
    df_split = pd.concat([X_train, X_test])
    df_hash = hash_pandas_object(df).sort_values()
    splitted_hash = hash_pandas_object(df_split).sort_values()
    assert (df_hash == splitted_hash).all()
def test_drift_detector_split(self):
    df = cudf.from_pandas(load_bank())
    y = df.pop('y')
    (X_train, X_test) = CumlToolBox.train_test_split(df.copy(), train_size=0.7, shuffle=True, random_state=9527)
    dd = dd_selector().get_detector()
    dd.fit(X_train, X_test)
    assert (len(dd.feature_names_) == 17)
    assert (len(dd.feature_importances_) == 17)
    assert dd.auc_
    assert (len(dd.estimator_) == 5)
    proba = dd.predict_proba(df)
    assert (proba.shape[0] == df.shape[0])
    df = cudf.from_pandas(load_bank())
    y = df.pop('y')
    p = int((df.shape[0] * 0.2))
    (X_train, X_test, y_train, y_test) = dd.train_test_split(df.copy(), y, test_size=0.2)
    assert (X_train.shape == ((df.shape[0] - p), df.shape[1]))
    assert (y_train.shape == ((df.shape[0] - p),))
    assert (X_test.shape == (p, df.shape[1]))
    assert (y_test.shape == (p,))
    df['y'] = y
    X_train['y'] = y_train
    X_test['y'] = y_test
    (df, X_train, X_test) = CumlToolBox.to_local(df, X_train, X_test)
    df_split = pd.concat([X_train, X_test])
    df_hash = hash_pandas_object(df).sort_values()
    splitted_hash = hash_pandas_object(df_split).sort_values()
    assert (df_hash == splitted_hash).all()