Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with examples in new function corr in the parser #3025

Closed
dvd101x opened this issue Sep 6, 2023 · 7 comments
Closed

Issue with examples in new function corr in the parser #3025

dvd101x opened this issue Sep 6, 2023 · 7 comments

Comments

@dvd101x
Copy link
Sponsor Collaborator

dvd101x commented Sep 6, 2023

Hi, I was checking on the new function corr to see how it works and found the following while typing help(corr) in the Demo

corr([2, 4, 6, 8], [1, 2, 3, 6])
# yields TypeError: Unexpected type of argument in function matrix (expected: string or Array or Matrix or boolean, actual: number, index: 0)

It works correctly by adding a dimension:

corr([[2, 4, 6, 8]], [[1, 2, 3, 6]])
# yields [0.95618288746751]

Nonetheless outside the parser it works as expected regarding if it's a 1D array

math.corr([2, 4, 6, 8], [1, 2, 3, 6])
// yields 0.9561828874675149

Also noticed that the second example includes the function matrix which is by default in the parser.

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]]))
# yields [0.95699416885036, 1]

So this could also work with a bit of simplification.

corr([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]], [[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]])
# or
corr([1, 2.2, 3, 4.8, 5; 1, 2, 3, 4, 5], [4, 5.3, 6.6, 7, 8; 1, 2, 3, 4, 5])
# yields [0.95699416885036, 1]

The function corr is really cool, just wanted to let you know of these issues in the parser.

@josdejong
Copy link
Owner

Thanks for bringing this up. So it looks like corr does not yet support a Matrix with 1d contents, like:

math.corr(math.matrix([2, 4, 6, 8]), math.matrix([1, 2, 3, 6]))

The second example indeed doesn't add much, maybe better to remove it.

@vrushaket would you like to refine the function corr a bit?

@vrushaket
Copy link
Contributor

@josdejong yes, i will make necessary refinement.

@josdejong
Copy link
Owner

Thanks!

@gwhitney
Copy link
Collaborator

gwhitney commented Oct 4, 2023

Since #3030 has been merged, can this be closed?

@josdejong
Copy link
Owner

O, yes, you're right. Closing it now.

@josdejong
Copy link
Owner

I'll post a message when the fix is published, that's not yet the case.

@josdejong
Copy link
Owner

The fix is published now in v11.11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants