Skip to content

Commit

Permalink
update Group docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Jun 14, 2024
1 parent 0e3790b commit 2b183be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/OnlineStatsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,11 @@ is_mergeable(o::T) where {T <: OnlineStat} = is_mergeable(T)
#-----------------------------------------------------------------------# Base.show
function Base.show(io::IO, o::OnlineStat)
print(io, name(o, false, false))
printstyled(io, ": ", color=:light_black)
print(io, "n=")
print(io, nobs_string(o))
printstyled(io, ": n=", nobs_string(o))
for (k,v) in pairs(additional_info(o))
printstyled(io, " |", color=:light_black)
print(io, " $k=")
print(IOContext(io, :compact => true), v)
print(IOContext(io, :compact => true), io, " | ", k, '=', v)
end
printstyled(io, " |", color=:light_black)
print(io, " value=")
show(IOContext(io, :compact => true, :displaysize => (1, 70)), value(o))
print(IOContext(io, :compact => true, :displaysize => (1, 70)), " | value=", value(o))
end
function name(T::Type, withmodule = false, withparams = true)
s = "OnlineStatsBase." * string(T)
Expand Down
3 changes: 3 additions & 0 deletions src/stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ observation `y`, `y[i]` is sent to `stats[i]`.
o = fit!(Group(m1 = Mean(), m2 = Mean()), eachrow(x))
o.stats.m1
o.stats.m2
o = Group(fill(Mean(), 10))
fit!(o, eachrow(randn(100, 10)))
"""
struct Group{T, S} <: StatCollection{S}
stats::T
Expand Down

0 comments on commit 2b183be

Please sign in to comment.