Open
Conversation
Implement a 1D adaptive sampling learner backed by BTreeMap/BTreeSet internals, matching the semantics of Python's adaptive.Learner1D. - Core Learner1D with tell/tell_pending/tell_many/ask/run methods - LossManager priority queue with O(1) interval lookup + sorted access - Built-in loss functions: Default, Uniform, Resolution, Curvature, Triangle, AbsMinLog, and Python callback support - 44 comprehensive Python tests covering all functionality - Python benchmark script for performance measurement
- Replace .expect() with error handling in python_callback_loss (CRITICAL) - Store out-of-bounds data separately to prevent neighbor query pollution (HIGH) - Keep x_scale constant as bounds span, not derived from data (HIGH) - Expose loss(real) parameter in PyO3 binding (MEDIUM) - Fix empty learner linspace to include right endpoint (MEDIUM) - Add interval-based tiebreaking in ask() loss comparison (MEDIUM) - Use iterator .any() for has_missing_bounds instead of Vec allocation (LOW) - Avoid cloning in rebuild_scale via free function (LOW) - Add 12 new tests covering OOB tells, callback exceptions, loss(real=False)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native Rust Learner1D module: BTreeMap-based, 12-15× faster than Python adaptive.Learner1D for typical workloads. 6 built-in losses + Python callback fallback.
run()method keeps the adaptive loop in Rust (only user f(x) crosses PyO3). 56 Python tests + 4 Rust tests pass. ~1,840 LOC total. 3 commits: feat, fix (review findings), refactor (cleanup pass −281 lines).