Skip to content

Fix support for models with custom objective functions (Issue #92)#93

Draft
siboehm wants to merge 1 commit intomasterfrom
sib/fix-custom-objective-issue92
Draft

Fix support for models with custom objective functions (Issue #92)#93
siboehm wants to merge 1 commit intomasterfrom
sib/fix-custom-objective-issue92

Conversation

@siboehm
Copy link
Copy Markdown
Owner

@siboehm siboehm commented May 5, 2025

Fixes #92

Summary

  • Adds support for models with custom objective functions where the objective= line is missing from the model file
  • Makes the 'objective' key nullable in the scanner
  • Properly handles missing objectives in the parser

Changes Made

  1. Updated lleaves/compiler/ast/scanner.py to make the 'objective' key nullable by adding null_ok=True
  2. Modified lleaves/compiler/ast/parser.py to handle cases where the objective is not present in the scanned model
  3. Added test case test_custom_objective to verify custom objective support

Test plan

  • Added test for custom objective model
  • Run existing test suite to ensure no regressions
  • Verify fix with user's actual custom objective model

🤖 Generated with Claude Code

- Make 'objective' key nullable in scanner.py
- Handle missing objective in parser.py
- Add test for custom objective model support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Bug that prevents supporting trees trained with a custom objective function

1 participant