Skip to content

Add outward-rounded tanh second-derivative interval bounds - #190

Open
MoritzMaibaum wants to merge 1 commit into
mainfrom
codex/tanh-second-derivative-main
Open

MoritzMaibaum wants to merge 1 commit into
mainfrom
codex/tanh-second-derivative-main

Conversation

@MoritzMaibaum

Copy link
Copy Markdown
Collaborator

The main branch has no scalar tanh'' enclosure. Add tanh_double_prime_bounds(Interval(a, b)), computing its range from the endpoints and any included stationary extrema at ±atanh(1/√3).

The implementation uses directed Decimal arithmetic and explicit brackets for elementary-function rounding, including near-zero cancellation, saturation, subnormal values, and uncertain critical-point membership. It needs no additional dependency. A PyTorch adapter preserves float32 outward padding and the known sign; this does not introduce a network Hessian API on main.

Includes the rounding argument, API documentation, and high-precision regression tests. Example: [0.5, 1] gives approximately [-0.769800359, -0.639700008].

Validation: full main test suite passed (117 tests). The committed tree matches the locally tested tree exactly.

Compute the scalar range from endpoints and included stationary extrema. Bound elementary-function and arithmetic errors with Decimal, including cancellation, saturation and subnormal cases. Expose tanh_double_prime_bounds and a compatible PyTorch adapter; document the rounding argument.

Validation: full main test suite, 117 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: 5b7b7c0011

ℹ️ 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 new scalar API usable without PyTorch

For users installing only the base package, from intervalnets import tanh_double_prime_bounds still fails: __init__.py proceeds to import .pytorch, that module catches the missing torch import and sets nn = None, and its class IntervalAdd(nn.Module) declaration then raises AttributeError, which this initializer does not catch. This makes the newly documented dependency-free API unusable unless the optional PyTorch extra is installed; the optional import must fail cleanly or be skipped when PyTorch is unavailable.

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