-
Notifications
You must be signed in to change notification settings - Fork 250
[hail] NDArray eye #9105
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
[hail] NDArray eye #9105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word "identity" is not present anywhere in the description as far as I can tell. I would include that somewhere for searchability purposes. Or we could just also add the identity
function which is basically the same as eye
but has a more discoverable name. identity
would just be implemented by calling eye
. https://numpy.org/doc/stable/reference/generated/numpy.identity.html#numpy.identity
Good point John. I had omitted "identity" since we didn't have an identity function, but it's worth adding, would help our new docsearch. If you're back, I can assign you instead. |
I'm back, feel free to assign me to some of these ndarray things. (Also let me know issues you run into when adding stuff) |
Rather than linking out to Numpy, I added an identity function. In a followup PR I will add the "k" argument to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change and we'll be good.
hail/python/hail/nd/nd.py
Outdated
|
||
Examples | ||
-------- | ||
>>> hl.eval(hl.nd.eye(2, dtype=hl.tint32)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should have one example where you pass M
, otherwise I think we are good to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* ndarray eye * fix * unnecessary cast * add identity * doc M
* ndarray eye * fix * unnecessary cast * add identity * doc M
Identity matrix, needed for ridge regression in Hail. This is obviously suboptimal, it should be a special instance of a sparse ndarray that specifies 'k', but this matches the Numpy implementation and represents a good start.