Skip to content
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

Something wrong with optimize.minimize #27

Open
PorterG2003 opened this issue Aug 24, 2018 · 8 comments
Open

Something wrong with optimize.minimize #27

PorterG2003 opened this issue Aug 24, 2018 · 8 comments

Comments

@PorterG2003
Copy link

PorterG2003 commented Aug 24, 2018

I have gone through to step 7 and I get this error when I try to run. the code is in the txt file
capture
nn.txt

@ahmedselim2017
Copy link

Which python version did you use?

@PorterG2003
Copy link
Author

PorterG2003 commented Jan 11, 2019 via email

@ahmedselim2017
Copy link

can you try it with python 2.7?

@jashan777
Copy link

Nope doesn't help

@jashan777
Copy link

Same error please help 😥

@jashan777
Copy link

Tried with python 3.7 and 2.7

@orla11
Copy link

orla11 commented Nov 19, 2019

same error here...

@AdinSoftic
Copy link

AdinSoftic commented Dec 21, 2020

Check your dimensions and types of costFunction, costFunctionWrapper and gradients.

costFunctionWrapper example:

(0.2910926425857629,
 array([ 0.04821723,  0.00665329, -0.00888183,  0.0366221 ,  0.00479581,
        -0.0064682 , -0.15313943, -0.13135109, -0.1915688 ]))

where costFunction is: 0.2910926425857629 and computeGradients:
[ 0.04821723 0.00665329 -0.00888183 0.0366221 0.00479581 -0.0064682 -0.15313943 -0.13135109 -0.1915688 ]

From documentation:

scipy.optimize.minimize(fun, x0, args=(), method=None, jac=None, hess=None, hessp=None, bounds=None, constraints=(), tol=None, callback=None, options=None)

If jac is a Boolean and is True, fun is assumed to return and objective and gradient as and (f, g) tuple.

For me, I made a mistake in costFunction, I had written division by 2 as *0,5 instead of *0.5

PS: I know the issue is older, but it could still be helpful for someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants