Repository navigation
Keep LearnerND's loss infinite until its bound points are evaluated - #513
Merged
basnijholt merged 2 commits intoDec 6, 2026
Merged
Conversation
Learner1D and Learner2D report an infinite loss until their bounds are evaluated, so a parallel run whose interior points come back first cannot reach a loss goal without them. LearnerND.loss() was the largest simplex loss of whatever had been told, so it was finite as soon as a few interior points triangulated, with every corner still pending: BlockingRunner returned above its goal and AsyncRunner returned without the corners and a loss below the goal. Return inf until bounds_are_done, which LearnerND has had all along without using it.
Assisted-by: MindRoom DevAgent:openai/gpt-6.2-sol <https://github.com/mindroom-ai/mindroom>
basnijholt
approved these changes
Dec 6, 2026
basnijholt
left a comment
Member
There was a problem hiding this comment.
Thanks for catching this and adding clean regression tests! I pushed a small follow-up commit to restrict the bounds_are_done check to real=True and keep _bounds_available for real=False so LearnerND matches #512, along with tests covering real=False and BalancingLearner with pending corners. Looks good to merge.
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.
Description
The
LearnerNDcounterpart of #512.Learner1D(since #271 and #512) andLearner2D(bounds_are_done) report an infinite loss until their bound points are evaluated, so a parallel run whose interior points come back first cannot reach a loss goal without the bounds.LearnerND.loss()had no such check: it is the largest simplex loss of whatever has been told, so as soon as a few interior points triangulate, the loss is finite while every corner is still pending. With bounds[(-1, 1), (-1, 1)], the four corners asked and four interior points told,loss()is0.0075;Learner2Din the same state givesinf.loss()now returnsinfuntilbounds_are_done. That property has been onLearnerNDsince it was added, but nothing used it. It checksdatafor every bound point, the corners of a box or the vertices of aConvexHull, so pending ones count as missing.askalready hands the bound points out first, so a run asks for nothing new.What it changes for a run, with corners that take 3 s, an interior that takes 20 ms,
loss_goal=0.01and 6 threads, 5 runs each:mainBlockingRunner: goal met when it returnsAsyncRunner: corners evaluatedAsyncRunner: loss below the goal with no corner evaluatedOn
main,BlockingRunnerwaits for the running corners while it cleans up, so they land, but it returns above its goal (0.22against0.01in one run).AsyncRunnercancels them and returns a learner whose loss still says it met the goal.New test
test_inf_loss_while_bound_points_are_pendingintest_learnernd.py, for a box and for a triangularConvexHull: with the bound points asked and four interior points told,loss()andloss(real=False)are infinite, still infinite with all but one bound point told, finite with all of them. Onmainboth cases fail at the first check.Run here (macOS, on
mainat 2507701):nox -e pytest_min_deps-3.12 pytest_all_deps-3.12 pytest_min_deps-3.13 pytest_all_deps-3.13 pytest_typeguard pytest_rust_backendall pass (3.11 and 3.14 are not installed here), andpre-commit run --all-filespasses, mypy included. The slowestLearnerNDtests (test_anisotropic_3dand theLearnerNDcases oftest_balancing_learner) take the same time as onmain.Checklist
pre-commit run --all(first install usingpip install pre-commit)pytestpassedType of change