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

[python-package] Expose ObjectiveFunction class #6586

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix build errors
  • Loading branch information
Atanas Dimitrov committed Jul 31, 2024
commit e98c1a1213e58572dfc7b8fd712dae735714f678
7 changes: 7 additions & 0 deletions include/LightGBM/c_api.h
Original file line number Diff line number Diff line change
@@ -1576,6 +1576,13 @@ LIGHTGBM_C_EXPORT int LGBM_ObjectiveFunctionInit(ObjectiveFunctionHandle handle,
int *num_data,
DatasetHandle dataset);

/*!
*/
LIGHTGBM_C_EXPORT int LGBM_ObjectiveFunctionEval(ObjectiveFunctionHandle handle,
const double* score,
float* grad,
float* hess);

/*!
*/
LIGHTGBM_C_EXPORT int LGBM_ObjectiveFunctionFree(ObjectiveFunctionHandle handle);
2 changes: 1 addition & 1 deletion src/io/config_auto.cpp
Original file line number Diff line number Diff line change
@@ -326,6 +326,7 @@ const std::unordered_set<std::string>& Config::parameter_set() {
}

void Config::GetMembersFromString(const std::unordered_map<std::string, std::string>& params) {
std::string tmp_str = "";
GetString(params, "data", &data);

if (GetString(params, "valid", &tmp_str)) {
@@ -587,7 +588,6 @@ void Config::GetMembersFromString(const std::unordered_map<std::string, std::str
GetInt(params, "objective_seed", &objective_seed);

GetInt(params, "num_class", &num_class);
std::cout << "What is this: " << num_class << std::endl;
CHECK_GT(num_class, 0);

GetBool(params, "is_unbalance", &is_unbalance);
1 change: 0 additions & 1 deletion tests/python_package_test/test_engine.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@

from .utils import (
SERIALIZERS,
assert_all_trees_valid,
builtin_objective,
dummy_obj,
load_breast_cancer,