Skip to content

added correlation function to statistics#3015

Merged
josdejong merged 9 commits into
josdejong:developfrom
vrushaket:correlation-function
Sep 1, 2023
Merged

added correlation function to statistics#3015
josdejong merged 9 commits into
josdejong:developfrom
vrushaket:correlation-function

Conversation

@vrushaket
Copy link
Copy Markdown
Contributor

@vrushaket vrushaket commented Aug 23, 2023

This PR adds correlation function to statistics and solves the issue "Correlation function #2624"

Copy link
Copy Markdown
Owner

@josdejong josdejong left a comment

Choose a reason for hiding this comment

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

Thanks for your PR! I made a few inline comments, can you have a look at those?

Comment thread src/function/statistics/correlation.js Outdated
Comment thread test/unit-tests/function/statistics/correlation.test.js
Comment thread package.json
Comment thread package.json Outdated
@vrushaket vrushaket force-pushed the correlation-function branch from 1d1d8cb to d6a403a Compare August 23, 2023 17:46
@vrushaket vrushaket requested a review from josdejong August 23, 2023 18:00
Copy link
Copy Markdown
Owner

@josdejong josdejong left a comment

Choose a reason for hiding this comment

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

Thanks @vrushaket , the function looks complete now and well tested.

One last thing: can you please make sure the function names and file names all consistently use "corr" and not "correlation"? I.e. rename correlation.js to corr.js, rename createCorrelation to createCorr, etc.

@vrushaket vrushaket force-pushed the correlation-function branch from 1e7afe6 to 37359fb Compare September 1, 2023 03:50
@vrushaket vrushaket requested a review from josdejong September 1, 2023 04:00
@vrushaket
Copy link
Copy Markdown
Contributor Author

Thanks @vrushaket , the function looks complete now and well tested.

One last thing: can you please make sure the function names and file names all consistently use "corr" and not "correlation"? I.e. rename correlation.js to corr.js, rename createCorrelation to createCorr, etc.

@josdejong as per asked changes, I have renamed correlation.js to corr.js, and createCorrelation to createCorr. Please check.

@josdejong
Copy link
Copy Markdown
Owner

Thanks, looks good.

I see one unit test is failing, I think it will be fixed by replacing

math.corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])) // returns [0.9569941688503644, 1])

with

math.corr(math.matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), math.matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])) // returns [0.9569941688503644, 1])

Can you try that?

@vrushaket
Copy link
Copy Markdown
Contributor Author

Thanks, looks good.

I see one unit test is failing, I think it will be fixed by replacing

math.corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])) // returns [0.9569941688503644, 1])

with

math.corr(math.matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), math.matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])) // returns [0.9569941688503644, 1])

Can you try that?

@josdejong I have made the necessary changes to pass the test case to ensure correct output of the function. Please check.

@josdejong
Copy link
Copy Markdown
Owner

Thanks, all tests pass now 🎉

@josdejong josdejong merged commit 1ee8733 into josdejong:develop Sep 1, 2023
@josdejong
Copy link
Copy Markdown
Owner

Published now in mathjs@11.11.0. Thanks again!

@josdejong josdejong mentioned this pull request Sep 5, 2023
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