dask-glm icon indicating copy to clipboard operation
dask-glm copied to clipboard

change to Numpy power ufunc

Open edenbaus opened this issue 6 years ago • 3 comments

Change builtin python power function to Numpy power ufunc

edenbaus avatar Apr 09 '18 04:04 edenbaus

Hi @edenbaus . Thanks for the PR. I'm a bit curious about this, I would have expected these to be more-or-less the same. Is there a performance difference?

mrocklin avatar Apr 09 '18 04:04 mrocklin

Hello,

Thanks for looking at my pull request.

I looked into the performance differences. I'm a bit surprised, but the base python power function tends to be faster than the numpy power function for power = 2. However, when raising values to a power > 2, the performance between the base python power function and the numpy power function is effectively identical.

The other difference is precision, numpy's power function offers much greater floating point precision over the base python power function.

Given the negligible performance difference between both approaches, it's your call if you think the increased precision is important enough to include this pull request.

Best Regards, Scott Edenbaum

On Mon, Apr 9, 2018 at 12:44 AM, Matthew Rocklin [email protected] wrote:

Hi @edenbaus https://github.com/edenbaus . Thanks for the PR. I'm a bit curious about this, I would have expected these to be more-or-less the same. Is there a performance difference?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dask/dask-glm/pull/70#issuecomment-379629724, or mute the thread https://github.com/notifications/unsubscribe-auth/AXy0QSr4x_79OUJGJfE923RNFhuApmLsks5tmucmgaJpZM4TL7EG .

edenbaus avatar Apr 09 '18 15:04 edenbaus

My guess would be that ** dispatches to np.power for numpy arrays.

mrocklin avatar Apr 09 '18 15:04 mrocklin