Skip to content

Commit 7911566

Browse files
committed
add pretty printing
1 parent 3d0416d commit 7911566

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/normalization.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ function NormalizedTraces(traces::AbstractTraces{names, TT}; trace_normalizer_pa
138138
NormalizedTraces{names, TT, typeof(traces), keys(nt), typeof(values(nt))}(traces, nt)
139139
end
140140

141+
function Base.show(io::IO, ::MIME"text/plain", t::NormalizedTraces{names,T}) where {names,T}
142+
s = nameof(typeof(t))
143+
println(io, "$s with $(length(names)) entries:")
144+
for n in names
145+
print(io, " :$n => $(summary(t[n]))")
146+
if n in keys(t.normalizers)
147+
println(io, " => Normalized")
148+
else
149+
println(io, "")
150+
end
151+
end
152+
end
153+
141154
@forward NormalizedTraces.traces Base.length, Base.size, Base.lastindex, Base.firstindex, Base.getindex, Base.view, Base.pop!, Base.popfirst!, Base.empty!, Base.parent
142155

143156
for f in (:push!, :pushfirst!, :append!, :prepend!)

test/normalization.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ import OnlineStats: mean, std
3737
unnormalized_batch = t[[1:5;]]
3838
@test unnormalized_batch[:reward] == [0:4;]
3939
@test extrema(unnormalized_batch[:state]) == (0, 4)
40-
4140
end

0 commit comments

Comments
 (0)