error: failed in converting 7th argument `g' of _lbfgsb.setulb to C/Fortran array

Viewed 277

Suppose

    def evaluateFunc(params):
        ...
        return err, grad

where params is a vector of N real values, err is a real number and grad is a vector of 2 real values.

    params = numpy.random.rand(X.shape[0]+1)
    bounds = np.append([(0,None)]*X.shape[0], [(None,None)], axis=0)

When I called the following function

params, minval, infos = fmin_l_bfgs_b(evaluateFunc, params, bounds=bounds)

I got the following error:

error: failed in converting 7th argument `g' of _lbfgsb.setulb to C/Fortran array

Why am I getting that error? How can I fix it?

EDIT

If I remove the parameter bounds=bounds, then I got the following error:

failed to initialize intent(inout|inplace|cache) array, input not an array
0 Answers
Related