How to Solve NameError: name 'optimize' is not defined -- scipy

Solution: Import the 'optimize' module

To Solve the error, add the following line to the top of your code.

from scipy import optimize

 

For more information:
Python scipy optimize