Skip to content

Tighten tanh Hessian intervals using stationary extrema - #191

Merged
MoritzMaibaum merged 1 commit into
better-intfrom
codex/tanh-second-derivative-better-int
Sep 28, 2026
Merged

MoritzMaibaum merged 1 commit into
better-intfrom
codex/tanh-second-derivative-better-int

Conversation

@MoritzMaibaum

Copy link
Copy Markdown
Collaborator

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_bounds scalar 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.

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.
@MoritzMaibaum
MoritzMaibaum merged commit 2a04d45 into better-int Sep 28, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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.

1 participant