Skip to main content
14 events
when toggle format what by license comment
Sep 26, 2019 at 2:49 comment added yiping @SᴀᴍOnᴇᴌᴀ I will re-edit my answer based on your link as soon as possible :) Thank you!
Sep 25, 2019 at 23:45 comment added Sᴀᴍ Onᴇᴌᴀ Welcome to Code Review! While OPs are encouraged to answer their own questions bear in mind that "Your answer must meet the standards of a Code Review answer, just like any other answer. Describe what you changed, and why. Code-only answers that don't actually review the code are insufficient and are subject to deletion"... perhaps adding a new question would be a better solution
Sep 25, 2019 at 23:40 review Low quality posts
Sep 26, 2019 at 4:21
Sep 23, 2019 at 21:27 history edited yiping CC BY-SA 4.0
deleted 54 characters in body
Sep 23, 2019 at 20:18 comment added GZ0 There's a typo in the name find_optiaml_threshold. Also, accessing / updating global variables generally has some performance overhead (although it is probably negligible in this case). A cleaner way is to pass groundtruth_masks and pred_mask as function arguments so that the function itself can be directly reused by others. And then in the measurement code, which does not need to be global, you make another wrapper function without arguments. The wrapper function can also be a lambda such as timeit.timeit(lambda:find_optimal_threshold(...), ...).
Sep 23, 2019 at 19:56 comment added yiping @GZ0 Thanks for the suggestions :) I have changed them. Cheers
Sep 23, 2019 at 19:55 history edited yiping CC BY-SA 4.0
more pythonic
Sep 23, 2019 at 7:01 comment added GZ0 Putting the entire code block in a string looks ugly. Instead, the code to be measured can be wrapped into a function test_func with no arguments and then called by timeit.timeit(test_func, ...) (you could find a better function name BTW).
Sep 23, 2019 at 6:22 history edited yiping CC BY-SA 4.0
deleted 68 characters in body
Sep 23, 2019 at 5:48 comment added yiping Yes, I have verified the correctness. It agrees with the naive implementation. Oh yeah, you are right! I will update it right now.
Sep 23, 2019 at 5:48 comment added GZ0 Timing program execution is normally done using the timeit module or %timeit / %%timeit in IPython.
Sep 23, 2019 at 5:42 comment added GZ0 Good job. I hope you have verified the correctness of the implementation (e.g., by comparing the results with your earlier implementation). Meanwhile, gt_total can actually be retrieved from the last row of gt_cumsum rather than computed again.
Sep 23, 2019 at 5:21 history edited yiping CC BY-SA 4.0
added 3 characters in body
Sep 23, 2019 at 1:25 history answered yiping CC BY-SA 4.0