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

Define multi-strategy parameter. #8890

Merged
merged 5 commits into from
Mar 10, 2023

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Mar 9, 2023

Extracted from #8616 .

  • Define a new field for LearnerTrainParam to support both model-per-target and vector leaf.

The naming is compo for composite and mono for monolithic. It's probably not the best name, please make your suggestions. ;-)

Sorry for polluting the change with include-what-you-use comments. I can remove them if it makes review difficult.

I plan to slowly integrate it into the xgboost code base to have a clear view of what we are using and to eliminate unneeded includes to reduce compile time. If reviewers prefer having a dedicated PR for header changes, please let me know in the comments. ;-)

@@ -779,9 +810,17 @@ class LearnerConfiguration : public Learner {
if (obj_ == nullptr || tparam_.objective != old.objective) {
obj_.reset(ObjFunction::Create(tparam_.objective, &ctx_));
}

bool has_nc {cfg_.find("num_class") != cfg_.cend()};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is made to fix the removed lines above. The change limits the inserted parameter into this function instead of propagating it through the entire library.

@@ -12,10 +12,11 @@
#include <vector>

#include "xgboost/c_api.h"
#include "xgboost/data.h" // DMatrix
#include "xgboost/data.h" // DMatrix
#include "xgboost/feature_map.h" // for FeatureMap
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature map is no longer included in learner.h. This is to fix missing includes.

Copy link
Collaborator

@hcho3 hcho3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my suggestion for naming.

src/learner.cc Outdated Show resolved Hide resolved
include/xgboost/learner.h Outdated Show resolved Hide resolved

void Copy(LearnerModelParam const& that);
[[nodiscard]] bool IsVectorLeaf() const noexcept { return multi_strategy == Strategy::kMono; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to myself: Treelite should soon add ability to handle vector leaf outputs from XGBoost models

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will take some time to mature. The current implementation is less than alpha.

src/learner.cc Outdated Show resolved Hide resolved
src/learner.cc Show resolved Hide resolved
@trivialfis trivialfis requested a review from hcho3 March 10, 2023 08:49
@trivialfis trivialfis merged commit 2aa838c into dmlc:master Mar 10, 2023
@trivialfis trivialfis deleted the multi-strategy-param branch March 10, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants