Repository navigation
Tighten tanh Hessian intervals using stationary extrema - #191
Conversation
Replace the dependent interval-product enclosure with the same outward-rounded scalar endpoint/extrema routine added to main. Preserve PyTorch float32 padding and the known sign. Add the scalar API, the rounding argument, high-precision regressions and Hessian integration tests. Affine PZ enclosures are unchanged. Validation: targeted interval/PZ tests, 236 passed; full better-int suite, 277 passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ef2cab15f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """Interval arithmetic utilities for neural network evaluation.""" | ||
|
|
||
| from .interval import Interval | ||
| from .activations import tanh_double_prime_bounds |
There was a problem hiding this comment.
Keep the scalar export importable without PyTorch
When the package is installed with only its base dependencies (PyTorch is optional in pyproject.toml), from intervalnets import tanh_double_prime_bounds still crashes: the later .pytorch import catches the missing-PyTorch ImportError, sets nn = None, and then evaluates class IntervalAdd(nn.Module), raising AttributeError. Consequently, the newly exported scalar API cannot be used in the explicitly documented no-PyTorch environment; the package initializer must avoid loading that module or the optional module must remain import-safe when PyTorch is absent.
Useful? React with 👍 / 👎.
The ordinary interval Hessian path evaluates tanh'' as -2T(1-T*T), losing dependencies and producing wide ranges. Replace it with endpoint and stationary-extremum evaluation using the same
tanh_double_prime_boundsscalar implementation as #190.For example, on [0.5, 1], the unpadded width decreases from approximately 0.809753 to 0.130100. Directed Decimal arithmetic bounds elementary-function and arithmetic errors without a new dependency. The PyTorch adapter preserves float32 outward padding and the derivative's known sign. Existing affine PZ enclosures are unchanged.
Includes public scalar access, the rounding argument, high-precision tests covering extreme numerical cases, and Hessian-path regression tests that exercise interior extrema.
Validation: targeted interval/PZ tests passed (236 tests); full better-int suite passed (277 tests). The committed tree matches the locally tested tree exactly.