From 5ada0fbed94e4261b85ec657354754b1c3e56601 Mon Sep 17 00:00:00 2001 From: vecxoz Date: Wed, 26 Dec 2018 17:24:18 +0200 Subject: [PATCH] Allow n-dim input for func API only. Some maintenance for tests. --- tests/test_sklearn_api_classification_binary.py | 5 +++++ vecstack/core.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tests/test_sklearn_api_classification_binary.py b/tests/test_sklearn_api_classification_binary.py index f6f2fa1..c2b2671 100644 --- a/tests/test_sklearn_api_classification_binary.py +++ b/tests/test_sklearn_api_classification_binary.py @@ -67,6 +67,11 @@ def roc_auc_score_universal(y_true, y_pred): """ ohe = OneHotEncoder(sparse=False) y_true = ohe.fit_transform(y_true.reshape(-1, 1)) + #@@@@ + if len(y_pred.shape) == 1: + y_pred = np.c_[y_pred, y_pred] + y_pred[:, 0] = 1 - y_pred[:, 1] + #@@@@ auc_score = roc_auc_score(y_true, y_pred) return auc_score diff --git a/vecstack/core.py b/vecstack/core.py index b7d372b..8c1bb4b 100644 --- a/vecstack/core.py +++ b/vecstack/core.py @@ -413,11 +413,13 @@ def your_metric(y_true, y_pred): accept_sparse=['csr'], # allow csr and cast all other sparse types to csr force_all_finite=False, # allow nan and inf because # some models (xgboost) can handle + allow_nd=True, multi_output=False) # do not allow several columns in y_train if X_test is not None: # allow X_test to be None for mode='oof' X_test = check_array(X_test, accept_sparse=['csr'], # allow csr and cast all other sparse types to csr + allow_nd=True, force_all_finite=False) # allow nan and inf because # some models (xgboost) can handle if sample_weight is not None: