{"action":"created","issue":{"url":"https://api.github.com/repos/rlabbe/filterpy/issues/44","repository_url":"https://api.github.com/repos/rlabbe/filterpy","labels_url":"https://api.github.com/repos/rlabbe/filterpy/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/rlabbe/filterpy/issues/44/comments","events_url":"https://api.github.com/repos/rlabbe/filterpy/issues/44/events","html_url":"https://github.com/rlabbe/filterpy/issues/44","id":169442390,"number":44,"title":"MerweScaledSigmaPoints weights do not sum to 1, documentation says it should","user":{"login":"peter-moran","id":2124385,"avatar_url":"https://avatars.githubusercontent.com/u/2124385?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-moran","html_url":"https://github.com/peter-moran","followers_url":"https://api.github.com/users/peter-moran/followers","following_url":"https://api.github.com/users/peter-moran/following{/other_user}","gists_url":"https://api.github.com/users/peter-moran/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-moran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-moran/subscriptions","organizations_url":"https://api.github.com/users/peter-moran/orgs","repos_url":"https://api.github.com/users/peter-moran/repos","events_url":"https://api.github.com/users/peter-moran/events{/privacy}","received_events_url":"https://api.github.com/users/peter-moran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-04T18:30:09Z","updated_at":"2016-08-11T13:26:43Z","closed_at":null,"body":"For example:\r\n\r\n    import numpy as np\r\n    from filterpy.kalman import MerweScaledSigmaPoints as SigmaPoints\r\n    \r\n    sigma_points = SigmaPoints(n=9, alpha=0.001, beta=2, kappa=-6)\r\n    Wm, Wc = sigma_points.weights()\r\n    print np.sum(Wm)\r\n    print np.sum(Wc)\r\n\r\nWhich returns\r\n\r\n    1.0000000005238689\r\n    3.9999990007490851\r\n\r\nWhile Wm is small enough to be rounding error, Wc seems to go against notes in the documentation. Now, I'm not saying MerweScaledSigmaPoints is set wrong -- as far as I can tell all the equations are right. However, the book and documentation both say that Wc \"must sum to 1\".\r\n\r\nSo what's the deal?"},"comment":{"url":"https://api.github.com/repos/rlabbe/filterpy/issues/comments/239160073","html_url":"https://github.com/rlabbe/filterpy/issues/44#issuecomment-239160073","issue_url":"https://api.github.com/repos/rlabbe/filterpy/issues/44","id":239160073,"user":{"login":"peter-moran","id":2124385,"avatar_url":"https://avatars.githubusercontent.com/u/2124385?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-moran","html_url":"https://github.com/peter-moran","followers_url":"https://api.github.com/users/peter-moran/followers","following_url":"https://api.github.com/users/peter-moran/following{/other_user}","gists_url":"https://api.github.com/users/peter-moran/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-moran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-moran/subscriptions","organizations_url":"https://api.github.com/users/peter-moran/orgs","repos_url":"https://api.github.com/users/peter-moran/repos","events_url":"https://api.github.com/users/peter-moran/events{/privacy}","received_events_url":"https://api.github.com/users/peter-moran/received_events","type":"User","site_admin":false},"created_at":"2016-08-11T13:26:43Z","updated_at":"2016-08-11T13:26:43Z","body":"I've been using n=9, alpha=0.01, beta=2, kappa=0, which returns the weights:\r\n\r\n```\r\nw_m = \r\n      [-9999.        ,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556]\r\n\r\nw_c = \r\n      [-9996.0001    ,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556,   555.55555556,\r\n         555.55555556,   555.55555556,   555.55555556]\r\n```\r\n\r\nWhich sum to `0.99999999999886313` and `3.9998999999995704` respectively.\r\n\r\nIf you follow the recommended guidelines for setting alpha and kappa, you'll see that [the first term is always negative](https://www.wolframalpha.com/input/?i=(a%5E2(L%2Bk)-L)%2F(L%2B(a%5E2(L%2Bk)-L))%3E0+where+L%3D9) for L=9.\r\n\r\n[These lecture slides](http://users.isy.liu.se/rt/fredrik/edu/sensorfusion/lecture5.pdf) indicate on page 23 that the negative weight is completely normal and that the covariance weights should sum to about 4."}}
{"actor":{"display_login":"peter-moran"}}