-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
turn the cryptically named scipy.special information theory functions into ufuncs #3981
Conversation
Running |
Maybe stuff all of them into a single .pxd file? There's no technical |
@pv OK I put them in to a |
test run exceeds 50 minutes |
Added the Huber loss function as a ufunc. This element-wise convex function is already used in scikit-learn, cvxpy, and statsmodels. |
Added the convex Pseudo-Huber function as a ufunc. This is used in statsmodels and could be used in scikit-learn. It's a smoother variant of the Huber function. |
LGTM, merging. |
turn the cryptically named scipy.special information theory functions into ufuncs
These ufuncs try to be careful about corner cases, and none of them can be directly replaced by existing ufuncs functions like xlogy. The
entr(x)
ufunc is very similar to-xlogy(x,x)
, but it has different behavior at negative x. The other two ufuncs are convex on all (x, y) whereas their earlier implementations that were clever enough to handle the limit at the origin still returned nan for some x,y points.These functions are intended to have the same definitions as the functions of the same name in "disciplined convex programming" (http://stanford.edu/~boyd/papers/disc_cvx_prog.html) projects like
cvx
andcvxpy
(note that these are different fromcvxopt
). The hope is that because these functions are so carefully defined, they can simplify some of the corner case headaches in higher level scipy functions related to statistics and divergences.