{"action":"created","issue":{"url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/12","labels_url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/12/comments","events_url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/12/events","html_url":"https://github.com/joshday/OnlineStats.jl/issues/12","id":72248193,"number":12,"title":"Weighting for stochastic methods","user":{"login":"joshday","id":8075494,"avatar_url":"https://avatars.githubusercontent.com/u/8075494?v=3","gravatar_id":"","url":"https://api.github.com/users/joshday","html_url":"https://github.com/joshday","followers_url":"https://api.github.com/users/joshday/followers","following_url":"https://api.github.com/users/joshday/following{/other_user}","gists_url":"https://api.github.com/users/joshday/gists{/gist_id}","starred_url":"https://api.github.com/users/joshday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshday/subscriptions","organizations_url":"https://api.github.com/users/joshday/orgs","repos_url":"https://api.github.com/users/joshday/repos","events_url":"https://api.github.com/users/joshday/events{/privacy}","received_events_url":"https://api.github.com/users/joshday/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-30T18:47:41Z","updated_at":"2015-05-06T12:57:10Z","closed_at":null,"body":"Stochastic types use weights of the form `nbatches ^ -const` where `const > .5 && const <= 1`, which doesn't fit into the current weighting scheme.  I need to think a bit more about how to handle this."},"comment":{"url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/comments/99444342","html_url":"https://github.com/joshday/OnlineStats.jl/issues/12#issuecomment-99444342","issue_url":"https://api.github.com/repos/joshday/OnlineStats.jl/issues/12","id":99444342,"user":{"login":"joshday","id":8075494,"avatar_url":"https://avatars.githubusercontent.com/u/8075494?v=3","gravatar_id":"","url":"https://api.github.com/users/joshday","html_url":"https://github.com/joshday","followers_url":"https://api.github.com/users/joshday/followers","following_url":"https://api.github.com/users/joshday/following{/other_user}","gists_url":"https://api.github.com/users/joshday/gists{/gist_id}","starred_url":"https://api.github.com/users/joshday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshday/subscriptions","organizations_url":"https://api.github.com/users/joshday/orgs","repos_url":"https://api.github.com/users/joshday/repos","events_url":"https://api.github.com/users/joshday/events{/privacy}","received_events_url":"https://api.github.com/users/joshday/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T12:57:10Z","updated_at":"2015-05-06T12:57:10Z","body":"I currently do have StochasticWeighting as a subtype of Weighting.  Instead of weighting a new observation as `1/n`, it will get weighted somewhere between `1/sqrt(n)` and `1/n` depending on the parameter `r`.\r\n\r\nHow \"bad\" is it to have `weight()` alter the argument without `!` in the function name?\r\n\r\n```julia\r\ntype StochasticWeighting <: Weighting\r\n    r::Float64\r\n    nb::Int64   # number of batches\r\n    λ::Float64  # minimum step size\r\n    function StochasticWeighting(r::Float64 = .51, λ::Float64 = 0.)\r\n        @assert r > .5 && r <= 1\r\n        @assert λ >= 0. && λ <= 1.\r\n        new(r, 0, λ)\r\n    end\r\nend\r\n@compat function weight(w::StochasticWeighting, unused, n2)\r\n    w.nb += n2\r\n    max(Float64(w.nb) ^ -w.r, w.λ)\r\nend\r\n```\r\nThus calling `weight(o)` will increment `w.nb` by one before returning the weight.\r\n"}}