scipy/minimize-unknown-option
| Rule | minimize-unknown-option |
|---|---|
| Pack | SciPy |
| Severity | error |
| Fix | none, edit by hand |
| Library versions | every version |
minimize warns and ignores an option that the chosen method does not know, so the setting has no effect. Use an option that the method takes, which show_options lists.
res = minimize(f, x0, method="L-BFGS-B", options={"disp": True, "maxiter": 200})res = minimize(f, x0, method="L-BFGS-B", options={"maxiter": 200})What the rule reports
Section titled “What the rule reports”The rule reports a key in the options= dict of optimize.minimize that the chosen method=
doesn't take but another method takes. Examples are disp and iprint for L-BFGS-B, maxiter
for TNC and maxfun for BFGS. On SciPy 1.18.1, minimize warns OptimizeWarning and ignores such a
key, and with 'trust-constr' it raises TypeError. xpd took the keys of each method from a run of
minimize with each pair of method and key.
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
minimize with method=$METH does not know the option $K and warns OptimizeWarning and ignores it. Use an option this method takes, which scipy.optimize.show_options('minimize', $METH) lists.Browse the other rules of the SciPy pack.