You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
got multiple values for argument 'constraints', 'bounds' #6655
This happens when a keyword argument is specified that overwrites a positional argument.
as scipy minimize already has bounds, constraints in the signature, and the options pass the bunds and constraints again.
It should handled the same way as jac and hess, thank you
If the issue has not been resolved, please file it in the issue tracker.
Expected Output
Run without give error
Output of import statsmodels.api as sm; sm.show_versions()
Which model?
Can you make up a simple example that we can run?
This was never checked.
aside: standard asymptotic theory for inference doesn't apply if the parameter can be at the boundary of the parameter space, i.e. if there are possibly binding inequality constraints.
according to the docs: optimizer
this should affect glm and all other models which can apply scipy optimizer .
The problem is due to the mismatch of the base/optimizer.py and the scipy's minimize function signature. scipy's minimize function has default named args for bounds and constraints.
statsmodels' optimizer put bounds, and constraints into the "options" and then pass to scipy's optimizer "options", but scipy has already has named args in its arg list, so cause the bunds and constraints be passed multiple times,
i verified by modified the optimizer.py
get the bounds and constraints from the kwargs and not put them into the options.
optimize.minimize(..., bounds=bounds, constraints=constraints, callback=callback, options=options)
@josef-pkt
I submitted the PR, but it seems one last check failed at get r dataset. Please review, with this constraints like monotone , nonnegative and complex restrictions can be applied. Thanks
Hi @josef-pkt, Is there anything else I need to add, the PR passed all checks and all comments has been addressed. Please guide for next step. Thank you.
Activity
josef-pkt commentedon Apr 22, 2020
Which model?
Can you make up a simple example that we can run?
This was never checked.
aside: standard asymptotic theory for inference doesn't apply if the parameter can be at the boundary of the parameter space, i.e. if there are possibly binding inequality constraints.
emailhy commentedon Apr 22, 2020
according to the docs: optimizer
this should affect glm and all other models which can apply scipy optimizer .
The problem is due to the mismatch of the base/optimizer.py and the scipy's minimize function signature. scipy's minimize function has default named args for bounds and constraints.
statsmodels' optimizer put bounds, and constraints into the "options" and then pass to scipy's optimizer "options", but scipy has already has named args in its arg list, so cause the bunds and constraints be passed multiple times,
i verified by modified the optimizer.py
get the bounds and constraints from the kwargs and not put them into the options.
optimize.minimize(..., bounds=bounds, constraints=constraints, callback=callback, options=options)
then it will work,
Thanks for this great package
emailhy commentedon Apr 22, 2020
Here is a minimal example
josef-pkt commentedon Apr 22, 2020
Thanks
I'm getting the correpsonding bounds error for the example
TypeError: _minimize_slsqp() got multiple values for argument 'bounds'this works, and imposes nonnegativity constraints in example
josef-pkt commentedon Apr 22, 2020
our
_fit_lbfgsuses
bounds = kwargs.setdefault('bounds', [(None, None)] * len(start_params))to get the separate keyword argument.@emailhy can you open a PR with your fix, and some unit tests?
emailhy commentedon Apr 23, 2020
@josef-pkt
I submitted the PR, but it seems one last check failed at get r dataset. Please review, with this constraints like monotone , nonnegative and complex restrictions can be applied. Thanks
emailhy commentedon Apr 26, 2020
@josef-pkt
I fixed all the format issues in my pull request, Thank you.
emailhy commentedon Apr 28, 2020
Hi @josef-pkt, Is there anything else I need to add, the PR passed all checks and all comments has been addressed. Please guide for next step. Thank you.
Kvothe-The-Bloodless commentedon Aug 3, 2021
I think there is a related bug:
gives
TypeError: _minimize_slsqp() got multiple values for argument 'jac'Do you agree? Is there a work around?
emailhy commentedon Aug 4, 2021
@Kvothe-The-Bloodless , that is scipy's bug, but you are right, same reason