{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/5700","labels_url":"https://api.github.com/repos/scipy/scipy/issues/5700/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5700/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/5700/events","html_url":"https://github.com/scipy/scipy/issues/5700","id":125871435,"number":5700,"title":"bounds API differ between least_squares and minimize","user":{"login":"anntzer","id":1322974,"avatar_url":"https://avatars.githubusercontent.com/u/1322974?v=3","gravatar_id":"","url":"https://api.github.com/users/anntzer","html_url":"https://github.com/anntzer","followers_url":"https://api.github.com/users/anntzer/followers","following_url":"https://api.github.com/users/anntzer/following{/other_user}","gists_url":"https://api.github.com/users/anntzer/gists{/gist_id}","starred_url":"https://api.github.com/users/anntzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anntzer/subscriptions","organizations_url":"https://api.github.com/users/anntzer/orgs","repos_url":"https://api.github.com/users/anntzer/repos","events_url":"https://api.github.com/users/anntzer/events{/privacy}","received_events_url":"https://api.github.com/users/anntzer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-11T04:35:50Z","updated_at":"2016-01-11T14:54:44Z","closed_at":null,"body":"Both the already existing `optimize.minimize` and the soon-to-be-released `optimize.least_squares` can take a `bounds` argument (for bounded minimization).  `minimize` takes a sequence of `(min, max)` pairs corresponding to each variable (and uses `None` for no bound -- actually `np.inf` also works, but triggers the use of a bounded algorithm), whereas `least_squares` takes a pair of sequences, resp. the mins and the maxs for each variable (and uses `np.inf` for no bound).\r\n\r\nIt would be nice to keep the same API in both cases, which would mean using a sequence of `(min, max)` pairs in `least_squares` (I actually prefer `np.inf` rather than `None` for no bound so I won't argue on that part).\r\n\r\nI apologize for bringing up yet another (relatively minor) issues so close to the release.  Unfortunately, it seems difficult to catch these before the release (I stumbled on `least_squares` somewhat by accident and I'm sure it's mostly unknown right now), and after the release there are backwards compatibility issues.  I wonder if a Provisional API mechanism would be suitable?\r\n\r\nPS: In any case, this function works great and has already been quite helpful in my work.  Thanks!\r\n\r\n@nmayorov @ev-br"},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/170578239","html_url":"https://github.com/scipy/scipy/issues/5700#issuecomment-170578239","issue_url":"https://api.github.com/repos/scipy/scipy/issues/5700","id":170578239,"user":{"login":"nmayorov","id":7074023,"avatar_url":"https://avatars.githubusercontent.com/u/7074023?v=3","gravatar_id":"","url":"https://api.github.com/users/nmayorov","html_url":"https://github.com/nmayorov","followers_url":"https://api.github.com/users/nmayorov/followers","following_url":"https://api.github.com/users/nmayorov/following{/other_user}","gists_url":"https://api.github.com/users/nmayorov/gists{/gist_id}","starred_url":"https://api.github.com/users/nmayorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmayorov/subscriptions","organizations_url":"https://api.github.com/users/nmayorov/orgs","repos_url":"https://api.github.com/users/nmayorov/repos","events_url":"https://api.github.com/users/nmayorov/events{/privacy}","received_events_url":"https://api.github.com/users/nmayorov/received_events","type":"User","site_admin":false},"created_at":"2016-01-11T14:54:44Z","updated_at":"2016-01-11T14:54:44Z","body":"First, I'm very glad that `least_squares` was helpful to you! (Maybe you can share examples of usage?)\r\n\r\nThis question of bounds API did arise previously. Admittedly I made this choice mostly by myself. I had 2 things in mind.\r\n\r\n1.  Let `lb=[-1, -2]` and `ub=[2, 5] `. Now one can specify bounds in 4 different ways:\r\n```\r\n1. bounds = (lb, ub)\r\n2. bounds = (-np.inf, ub) (can be a finite number instead of inf)\r\n3. bounds = (lb, np.inf)\r\n4. bounds = (0, 10)\r\n```\r\nAll of them are logical and consistent with each other (and all cases are clearly covered in the documentation).\r\n\r\nIf we change it to `minimize'` style:\r\n```\r\n1. bounds = zip(lb, ub)\r\n2. bounds = (-np.inf, ub)\r\n3. bounds = (lb, np.inf)\r\n4. bounds = (0, 10)\r\n```\r\nWhile 1 and 4 are fine, 2 and 3 are not really consistent and may be confusing, but on the other case they are useful. I also admit that case 1 feels slightly more intuitive (for me at least) when done in `minimize'` style.\r\n2. I really didn't like `None`, it doesn't fit into \"array style\" of doing things in numpy/scipy.\r\n\r\nSo I decided to abandon API compatibility and make a version which I think is generally better. I realize this is a questionable decision. \r\n\r\nMore opinions on this issue are welcome."}}