-
Notifications
You must be signed in to change notification settings - Fork 25
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
Implement argmin argmax #30
Conversation
Hi @phungleson thanks for the contribution! I think it was a great idea to raise this PR and get a conversation started 👍. I'm a volunteer. I am happy to keep an eye out for comments and changes, review/discuss ideas and generally cheer you on. It certainly looks like this code would work, but I agree we need to get to a point where we are all happy it's the right implementation. I suggest the next step in achieving that is to wrap some tests around it so we can experiment with the implementation without risk of breaking things. May not need to be deep coverage at this stage, but it's up to you. I would think about relevant ndarray shapes, types and error cases. From quick review it looks like its run-time complexity is Have you had a look for ideas from existing implementations in other technologies? For example numpy and Julia - how do they implement this? Are there any special algorithms people use that are better than the intuitive approach? Thanks. I hope this helps. |
Hey @munckymagik thanks for the comment! :) I have added a few tests and For https://github.com/numpy/numpy/blob/v1.10.1/numpy/core/fromnumeric.py#L967 For Julia, it seems like it just get the first index of min and returns that value (not a https://github.com/JuliaLang/julia/blob/80516ca20297a67b996caa08c38786332379b6a5/base/array.jl#L2159 Perhaps we can do it in a way similar to Julia but we can return a |
Thanks for jumping in @munckymagik! The issues and PRs of this repo are getting crowded, that's super cool 🚀 I guess the main choice we have to make concerns the number of outputs to be returned: if there is more than one minimum/maximum value, do we return just the indices for the first minimum/maximum value we encounter or do we want to return them all? If we align with Julia/NumPy, returning just the first one, then we should be able to get complexity down to |
Cool thanks, I have changed to return a single value. As the idea of this lib is to be closer to Let me know if returning a If this looks ok, I will add |
I left some comments for polishing, but the functionality is there 💯 @phungleson |
@LukeMathWalker Hey mate, I have made the changes, let me know if anything else is still missing. I probably will add |
I agree with small PRs - feel free to work the |
Hey mates, this PR currently has a rough
impl
forargmin
for discussions.Please have some comments. Once everyone is happy with the implementation, I will add necessary docs, tests.. and other methods.