Skip to content

Commit

Permalink
Merge pull request #20 from vecxoz/dev
Browse files Browse the repository at this point in the history
Allow n-dimensional input for func API. Some maintenance for tests.
  • Loading branch information
vecxoz authored Jan 6, 2019
2 parents be81eff + 5ada0fb commit cd7f6ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_sklearn_api_classification_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions vecstack/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cd7f6ef

Please sign in to comment.