-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow counts argument in fit!
#284
Comments
I see that |
fit!
fit!
It's a reasonable request for |
I'm looking through CountMap{T, A <: AbstractDict{T, Int}} <: OnlineStat{Union{T, Pair{<:T,<:Integer}}} which means it can accept a
I'm inclined towards option 2 as then there is no ambiguity of if a stat can fit a pair-type observation. Generally the new code would be fit!(o::OnlineStat{T}, xy::Pair{<:T, <:Integer}) where {T} = (_fit!(o, xy); return o)
function _fit!(o::OnlineStat{T}, xy::Pair{<:T, <:Integer}) where {T}
x, y = xy
for _ in 1:y
_fit!(o, x)
end
return o
end I think CountMap could either keep or drop the |
So now I'm remembering why I haven't done this...
I think we need a new function to indicate counts, In retrospect, building |
|
It would be really convenient to be allowed to call
fit!(o, y, k)
as a shorthand way to fit observationy
k
times. Many stats would support this with little change, like theHist
stat for example. You would change lines 94-101into
I'm not sure how much extra work this would be, but I would be happy to draft a pull request trying to implement this if there is interest.
The text was updated successfully, but these errors were encountered: