Add explicit support for certain objectives and apply the sigmoid when appropriate#118
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds one entry for the "reg-squarederror" model to the TestGenerateAndRunModels table-driven test so the generation and go-run execution flow runs for that model. ChangesTest coverage for reg-squarederror model
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces support for parsing XGBoost model metadata, specifically handling objectives like binary:logistic, reg:logistic, and reg:squarederror, and incorporates the model's base score (intercept) and objective function into the generated Go code. It also adds regression test data and corresponding tests. The review feedback highlights a potential issue where NaN or Inf values in the base_score could bypass validation and cause silent failures or uncompilable code, suggesting explicit checks and unit tests for these edge cases. Additionally, it recommends setting random_state in the test model generation script to ensure reproducibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
52d982b to
41ebce1
Compare
… of base_score and when a sigmoid should be applied
41ebce1 to
3852d56
Compare
horgh
left a comment
There was a problem hiding this comment.
Looks great! Just a couple minor comments.
This also fixes a lingering base_score issue. This hasn't been a problem with logistic objectives when base_score is 0.5 as that reduces to a baseline raw margin of 0. But if base_score is anything else, or if the objective is something like
reg:squarederrorthen xgb2code generated code will produce incorrect output.Summary by CodeRabbit