Re: [Numpy-discussion] Help - numpy / scipy binary compatibility
On Sat, Aug 9, 2014 at 10:41 AM, Matthew Brett wrote: > Hi, > > I would be very happy of some help trying to work out a numpy package > binary incompatibility. > > I'm trying to work out what's happening for this ticket: > > https://github.com/scipy/scipy/issues/3863 > > which I summarized at the end: > > https://github.com/scipy/scipy/issues/3863#issuecomment-51669861 > > but basically, we're getting these errors: > > RuntimeWarning: numpy.dtype size changed, may indicate binary > incompatibility > > I now realize I am lost in the world of numpy / scipy etc binary > compatibility, I'd really like some advice.In this case > > numpy == 1.8.1 > scipy == 0.14.0 - compiled against numpy 1.5.1 > scikit-learn == 0.15.1 compiled against numpy 1.6.0 > > Can y'all see any potential problem with those dependencies in binary > builds? > > The relevant scipy Cython c files seem to guard against raising this > error by doing not-strict checks of the e.g. numpy dtype, so I am > confused how these errors come about. Can anyone give any pointers? > Assuming the message is not bogus, I would try import von_mises with a venv containing numpy 1.5.1, then 1.6.0, etc... to detect when the change happened. David > Cheers, > > Matthew > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Help - numpy / scipy binary compatibility
Hi, I would be very happy of some help trying to work out a numpy package binary incompatibility. I'm trying to work out what's happening for this ticket: https://github.com/scipy/scipy/issues/3863 which I summarized at the end: https://github.com/scipy/scipy/issues/3863#issuecomment-51669861 but basically, we're getting these errors: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility I now realize I am lost in the world of numpy / scipy etc binary compatibility, I'd really like some advice.In this case numpy == 1.8.1 scipy == 0.14.0 - compiled against numpy 1.5.1 scikit-learn == 0.15.1 compiled against numpy 1.6.0 Can y'all see any potential problem with those dependencies in binary builds? The relevant scipy Cython c files seem to guard against raising this error by doing not-strict checks of the e.g. numpy dtype, so I am confused how these errors come about. Can anyone give any pointers? Cheers, Matthew ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] OpenBLAS and dotblas
Charles R Harris wrote: > It looks like numpy dot only uses BLAS if ATLAS is present, see > numpy/core/setup.py. Has anyone done the mods needed to use OpenBLAS? What > is the current status of using OpenBLAS with numpy? I thought it also uses BLAS if MKL or Accerate Framework is present, but I am not sure about OpenBLAS, ACML or Cray libsci. Sturla ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Calculation of a hessian
Do it in pure numpy? How about copying the source of numdifftools? What exactly is the obstacle to using numdifftools? There seem to be no licensing issues. In my experience, its a crafty piece of work; and calculating a hessian correctly, accounting for all kinds of nasty floating point issues, is no walk in the park. Even if an analytical derivative isn't too big a pain in the ass to implement, there is a good chance that what numdifftools does is more numerically stable (though in all likelihood much slower). The only good reason for a specialized solution I can think of is speed; but be aware what you are trading it in for. If speed is your major concern though, you really cant go wrong with Theano. http://deeplearning.net/software/theano/library/gradient.html#theano.gradient.hessian ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Calculation of a hessian
Your function looks fairly simple to differentiate by hand, but if you have access to the gradient (or you estimate it numerically using scipy...), this function might do the job: def hessian ( x, the_func, epsilon=1e-8): """Numerical approximation to the Hessian Parameters x: array-like The evaluation point the_func: function The function. We assume that the function returns the function value and the associated gradient as the second return element epsilon: float The size of the step """ N = x.size h = np.zeros((N,N)) df_0 = the_func ( x )[1] for i in xrange(N): xx0 = 1.*x[i] x[i] = xx0 + epsilon df_1 = the_func ( x )[1] h[i,:] = (df_1 - df_0)/epsilon x[i] = xx0 return h Jose On 8 August 2014 08:31, Kiko wrote: > Hi all, > > I am trying to calculate a Hessian. I am using numdifftools for this ( > https://pypi.python.org/pypi/Numdifftools). > > My question is, is it possible to make it using pure numpy?. > > The actual code is like this: > > > *import numdifftools as nd* > *import numpy as np* > > *def log_likelihood(params):* > *sum1 = 0; sum2 = 0* > *mu = params[0]; sigma = params[1]; xi = params[2]* > *for z in data:* > *x = 1 + xi * ((z-mu)/sigma)* > *sum1 += np.log(x)* > *sum2 += x**(-1.0/xi)* > *return -((-len(data) * np.log(sigma)) - (1 + 1/xi)*sum1 - sum2) # > negated so we can use 'minimum'* > > *kk = nd.Hessian(log_likelihood)* > > Thanks in advance. > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Calculation of a hessian
Hi all, I am trying to calculate a Hessian. I am using numdifftools for this ( https://pypi.python.org/pypi/Numdifftools). My question is, is it possible to make it using pure numpy?. The actual code is like this: *import numdifftools as nd* *import numpy as np* *def log_likelihood(params):* *sum1 = 0; sum2 = 0* *mu = params[0]; sigma = params[1]; xi = params[2]* *for z in data:* *x = 1 + xi * ((z-mu)/sigma)* *sum1 += np.log(x)* *sum2 += x**(-1.0/xi)* *return -((-len(data) * np.log(sigma)) - (1 + 1/xi)*sum1 - sum2) # negated so we can use 'minimum'* *kk = nd.Hessian(log_likelihood)* Thanks in advance. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion