Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow n-dimensional input for func API. Some maintenance for tests. #20

Merged
merged 1 commit into from
Jan 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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