Conversation
#211 Introduces an Extrapolation discriminated union and a new Stats.interpolateLinearWith function that lets callers control what happens for keys that fall outside the source series range: - Clamp – retain the nearest boundary value (same as interpolateLinear) - Missing – produce a missing value (nan) for out-of-range keys - Linear – continue the boundary slope linearly The existing interpolateLinear is unchanged. A C# extension method InterpolateLinearWith is also added in SeriesStatsExtensions. Four regression tests cover all three modes and the in-range path. Co-authored-by: Copilot <[email protected]>
…ar-with-409d292233147528
9 tasks
…ar-with-409d292233147528
…ar-with-409d292233147528
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.
🤖 Repo Assist — automated implementation
Summary
Implements the feature requested in #211 and approved by
@tpetricekin 2014: a newStats.interpolateLinearWithfunction with configurable extrapolation behavior for keys that fall outside the range of the source series.New API
F# module function
Stats.interpolateLinearWith keys : 'K seq keyDiff : 'K -> 'K -> float extrapolation : Extrapolation series : Series<'K, 'V> -> Series<'K, float>Extrapolationdiscriminated union (new type)ClampinterpolateLinearMissingLinearC# extension method
Usage example
Implementation notes
interpolateLinearis unchanged — fully backwards-compatible.Linearextrapolation the boundary slopes are pre-computed from the first/last two points of the series before the interpolation loop.KeyCount < 2)Linearfalls back toClampsince no slope can be computed.Test Status