Conversation
`OptimizationConfig.seed` was `PositiveInt`, so `seed=0` was rejected even though `Pipeline(seed=0)` accepts it. This also broke `Pipeline.from_preset(name, seed=0)`, which builds an `OptimizationConfig`. Switch to `NonNegativeInt`, regenerate the JSON schema, and add tests. Closes deeppavlov#352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation, schema, and boundary tests are aligned with no unresolved issues.
Review effort: Lite
Findings: None
What changed in this PR
Updates OptimizationConfig.seed to accept 0 while continuing to reject negative values.
Changes:
- Changed
seedfromPositiveInttoNonNegativeInt. - Regenerated the optimizer configuration schema.
- Added boundary validation tests.
| File | Description |
|---|---|
tests/configs/test_full_config.py |
Tests zero, positive, and negative seeds. |
src/autointent/_optimization_config.py |
Allows non-negative optimization seeds. |
docs/optimizer_config.schema.json |
Documents the updated minimum seed value. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
duplicate of #358 |
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.
Closes #352
Summary
OptimizationConfig.seedwas declaredPositiveInt, soseed=0was rejected, whilePipeline(seed=...)andPipeline.from_search_space(seed=...)accept it. This also brokePipeline.from_preset(name, seed=0)andPipeline.from_optimization_config, which build anOptimizationConfig.Changes
seed: PositiveInt→seed: NonNegativeInt. Negative seeds are still rejected (numpy doesn't accept them).docs/optimizer_config.schema.json(exclusiveMinimum: 0→minimum: 0).seedaccepts 0/1/42 and rejects -1.Testing
pytest tests/configs/test_full_config.py: 6 passedPipeline.from_preset("classic-light", seed=0)now worksruff check/ruff format --checkpass🤖 Generated with Claude Code