Conversation
Add two new pairwise matrix functions to the Stats type: - Stats.corrMatrix : Frame<'R,'C> -> Frame<'C,'C> Returns the square Pearson correlation matrix for all numeric columns. Diagonal entries are 1.0; off-diagonal entries match Stats.corr. - Stats.covMatrix : Frame<'R,'C> -> Frame<'C,'C> Returns the square sample covariance matrix for all numeric columns. Diagonal entries equal the sample variance of each column. Both use the existing Stats.corr / Stats.cov pair-wise functions and follow the same pattern as Stats.describe (numeric columns only, NaN when insufficient data). 5 new tests added to tests/Deedle.Tests/Stats.fs; all 73 stats tests pass. Co-authored-by: Copilot <[email protected]>
9 tasks
…20-d1c58e33c7e15801
Member
|
/repo-assist fix failures |
…e.Math overload collision Stats.corrMatrix and Stats.covMatrix in Deedle.Math return Matrix<float> (via MathNet.Numerics). The newly added functions in Deedle core with the same names return Frame<'C,'C>, causing F# overload ambiguity that broke PCA.fs, Finance.fs and Stats.fs in Deedle.Math. Rename the core functions to corrFrame / covFrame, which: - Eliminates the name collision with Deedle.Math's Matrix-returning variants - Better conveys the return type (a Frame, not a Matrix) - Follows the existing Deedle.Math convention where 'corr'/'cov' (no suffix) return a Frame and 'corrMatrix'/'covMatrix' return a Matrix Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 This is an automated response from Repo Assist. CI failures fixed. The build was failing because Fix: Renamed the core functions to
All 690 tests pass locally.
|
dsyme
approved these changes
Mar 21, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds two pairwise matrix functions to the
Statstype, filling a natural gap alongside the existingStats.corrandStats.covpair-wise functions:Stats.corrMatrix : Frame<'R,'C> -> Frame<'C,'C>— Pearson correlation matrixStats.covMatrix : Frame<'R,'C> -> Frame<'C,'C>— sample covariance matrixBoth operate on numeric columns only (same as
Stats.describe). The result is a square frame whose row and column keys are the original column names.Usage
Implementation
The implementation follows the pattern of
Stats.describe: iterate over numeric columns withframe.GetColumns(float)(), compute the pairwise statistic using the existingStats.corr/Stats.cov, and reassemble viaFrameUtils.fromColumns.Test status
5 new tests added to
tests/Deedle.Tests/Stats.fs:Full stats test suite (73 tests) all pass with no regression.