{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/5479","labels_url":"https://api.github.com/repos/scipy/scipy/issues/5479/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5479/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/5479/events","html_url":"https://github.com/scipy/scipy/pull/5479","id":115865175,"number":5479,"title":"ENH: return Jacobian/Hessian from BasinHopping","user":{"login":"samvrlewis","id":3880246,"avatar_url":"https://avatars.githubusercontent.com/u/3880246?v=3","gravatar_id":"","url":"https://api.github.com/users/samvrlewis","html_url":"https://github.com/samvrlewis","followers_url":"https://api.github.com/users/samvrlewis/followers","following_url":"https://api.github.com/users/samvrlewis/following{/other_user}","gists_url":"https://api.github.com/users/samvrlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/samvrlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvrlewis/subscriptions","organizations_url":"https://api.github.com/users/samvrlewis/orgs","repos_url":"https://api.github.com/users/samvrlewis/repos","events_url":"https://api.github.com/users/samvrlewis/events{/privacy}","received_events_url":"https://api.github.com/users/samvrlewis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scipy/scipy/labels/enhancement","name":"enhancement","color":"bfe5bf"},{"url":"https://api.github.com/repos/scipy/scipy/labels/scipy.optimize","name":"scipy.optimize","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-11-09T12:11:31Z","updated_at":"2015-11-17T09:32:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/5479","html_url":"https://github.com/scipy/scipy/pull/5479","diff_url":"https://github.com/scipy/scipy/pull/5479.diff","patch_url":"https://github.com/scipy/scipy/pull/5479.patch"},"body":"Returns the Jacobian and/or Hessian in the optimize.Basinhopping module, if it exists. Closes https://github.com/scipy/scipy/issues/5259. \r\n\r\nI've only written a unit test for the Jacobian part as I could not find any minimizers that returned a Hessian in the OptimizeResult object. Maybe I've overlooked something?\r\n\r\nThis is my first scipy contribution so I'd appreciate any feedback. Don't hold back if I've done something horribly wrong or if there's any suggestion of how I could do things better. :)"},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/157318883","html_url":"https://github.com/scipy/scipy/pull/5479#issuecomment-157318883","issue_url":"https://api.github.com/repos/scipy/scipy/issues/5479","id":157318883,"user":{"login":"samvrlewis","id":3880246,"avatar_url":"https://avatars.githubusercontent.com/u/3880246?v=3","gravatar_id":"","url":"https://api.github.com/users/samvrlewis","html_url":"https://github.com/samvrlewis","followers_url":"https://api.github.com/users/samvrlewis/followers","following_url":"https://api.github.com/users/samvrlewis/following{/other_user}","gists_url":"https://api.github.com/users/samvrlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/samvrlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvrlewis/subscriptions","organizations_url":"https://api.github.com/users/samvrlewis/orgs","repos_url":"https://api.github.com/users/samvrlewis/repos","events_url":"https://api.github.com/users/samvrlewis/events{/privacy}","received_events_url":"https://api.github.com/users/samvrlewis/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T09:32:08Z","updated_at":"2015-11-17T09:32:08Z","body":"> But on the other hand you could imagine someone writing another PR in a few months to copy over another attribute of the OptimizeResult. And many attributes exist for one optimizer and not the others. Or someone might use a custom optimizer returning a OptimizeResult object with custom attributes\r\n\r\nAh true, what about something like this? I guess the only problem with this is that you lose some of the attributes of the OptimizeResult for the minimum that are set separately. (Like nfev or njev).\r\n\r\n    res = bh.res\r\n    res.message = message\r\n    res.nit = i + 1\r\n\r\n    lowest_minres = bh.storage.get_lowest()\r\n\r\n    # Copy across the attributes into our return object,\r\n    # making sure not to overwrite attributes set in the BasinHopping routine\r\n    for attribute in lowest_minres:\r\n        if attribute not in res:\r\n            res[attribute] = lowest_minres[attribute]\r\n\r\n"}}