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

Support exporting cut values #9356

Merged
merged 11 commits into from
Jul 8, 2023
Merged

Support exporting cut values #9356

merged 11 commits into from
Jul 8, 2023

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Jul 4, 2023

Deviating from the rest of the API functions, the value is returned as a json array interface. The choice is optional, but I want to start the discussion of this choice as we will return more complicated arrays in the future including CUDA arrays.

  • Add functions to export cut values in C and Python.
  • Move ellpackpage into src for accessing HistogramCuts.
  • Tests.

Downstream projects can use the information to compress the tree model if needed.

Copy link
Member

@RAMitchell RAMitchell left a comment

Choose a reason for hiding this comment

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

Is this a feature request?

@trivialfis
Copy link
Member Author

No. I'm looking into enabling inference libraries to use the quantization result to compress the model.

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.

LGTM. (I only reviewed the Python portion)

Currently, Treelite performs unique operation to get the cut values from thresholds. This functionality will be useful, as we can skip the unique operation.

@trivialfis
Copy link
Member Author

trivialfis commented Jul 8, 2023

@hcho3 Please note that this PR doesn't work with approx, which changes cut value for each iteration

@trivialfis
Copy link
Member Author

One will have to get the value for every iteration. Currently, this has to be done through some hacks.

@trivialfis trivialfis merged commit 20c52f0 into dmlc:master Jul 8, 2023
21 checks passed
@trivialfis trivialfis deleted the export-cuts branch July 8, 2023 07:32
@hcho3
Copy link
Collaborator

hcho3 commented Jul 8, 2023

For now, Treelite can continue to scan the thresholds manually to compute the smallest integer width that will fit all thresholds.

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.

3 participants