Skip to content

[variations] Add support for extrapolation#1697

Merged
cmyr merged 1 commit into
mainfrom
variation-extrapolation
Oct 16, 2025
Merged

[variations] Add support for extrapolation#1697
cmyr merged 1 commit into
mainfrom
variation-extrapolation

Conversation

@cmyr

@cmyr cmyr commented Oct 16, 2025

Copy link
Copy Markdown
Member

This adds the ability for us to handle extrapolation in the variation model, which is used by smart components.

(on top of #1696)

///
/// Specifically, the `axis_ranges` argument implies extrapolation: it is
/// a map of the allowed ranges for input values. If it is `None`, then we
/// will only allow values in the range `-1.0..=1.0`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a bit weird and non-obvious and makes for weird calls with , None. Lets just have a different method to compute with extrapolation? Or just have the model you create with new_extrapolating always do it, keep the signature of scalar_at?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so i tried that out first but it felt weird: there are only two calls to this method (outside of tests) so it felt like an additional complication to add an extra method just for that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Those two calls, and all the test calls, go from being relatively intuitive to wtf is the , None.

Thinking "aloud,"

We are already constructing an explicitly extrapolating model, why can't it capture enough to do the right thing in scalar_at without changing the signature?

If that won't work lets just add a different entry point since presumably the caller explicitly knows they want a scalar with extrapolation?

If even that won't work for some reason then I suggest we use an enum other than Option, e.g. scalar_at(loc, Extrapolation::Off) vs scalar_at(loc, Extrapolation::On(range) to mitigate the wtf is None issue.

@rsheeter rsheeter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM subject to some sort of change to address scalar_at

Base automatically changed from interpolate-deltas-method to main October 16, 2025 20:54
This is necessary in order for smart components to work correctly.
@cmyr cmyr force-pushed the variation-extrapolation branch from e99511f to f3ad865 Compare October 16, 2025 20:56
@cmyr cmyr added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 824c4e6 Oct 16, 2025
12 checks passed
@cmyr cmyr deleted the variation-extrapolation branch October 16, 2025 21:01
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.

2 participants