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

[CUDA] Add binary objective for cuda_exp #5425

Merged
merged 11 commits into from
Aug 31, 2022
Merged

Conversation

shiyu1994
Copy link
Collaborator

Add binary objective for cuda_exp. (#5163)

@guolinke
Copy link
Collaborator

it seems the cuda self-hosted machine in queue? BTW, do we have a test for the cuda binary objective?

@shiyu1994
Copy link
Collaborator Author

BTW, do we have a test for the cuda binary objective?

I think this can be covered by existing tests for binary objective on CPUs, for example,

def test_binary():
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=42)
params = {
'objective': 'binary',
'metric': 'binary_logloss',
'verbose': -1,
'num_iteration': 50 # test num_iteration in dict here
}
lgb_train = lgb.Dataset(X_train, y_train)
lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train)
evals_result = {}
gbm = lgb.train(
params,
lgb_train,
num_boost_round=20,
valid_sets=lgb_eval,
callbacks=[lgb.record_evaluation(evals_result)]
)
ret = log_loss(y_test, gbm.predict(X_test))
assert ret < 0.14
assert len(evals_result['valid_0']['binary_logloss']) == 50
assert evals_result['valid_0']['binary_logloss'][-1] == pytest.approx(ret)

because we are replacing the default device with cuda_exp in

grep -q 'std::string device_type = "cuda_exp"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done

when testing for cuda_exp version.

@shiyu1994
Copy link
Collaborator Author

It is weird that this PR should now passes all the tests. But my local tests are failing with cuda_exp enabled. I'm taking a deeper check into this.

@shiyu1994 shiyu1994 requested a review from jmoralez as a code owner August 30, 2022 12:24
@shiyu1994 shiyu1994 merged commit 2b8fe8b into master Aug 31, 2022
@shiyu1994 shiyu1994 deleted the cuda/objective-binary branch August 31, 2022 01:33
@jameslamb jameslamb mentioned this pull request Oct 7, 2022
40 tasks
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants