Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ReinforcementLearningCore/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ReinforcementLearningCore.jl Release Notes

#### v0.15.5

- Move `UnicodePlots` to package extension

#### v0.15.4

- Update `Flux.jl` to `v0.16` and fix deprecation warnings and method errors
Expand Down
9 changes: 6 additions & 3 deletions src/ReinforcementLearningCore/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.15.4"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
CircularArrayBuffers = "9de3a189-e0c0-4e15-ba3b-b14b9fb0aec1"
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
Expand All @@ -21,11 +20,15 @@ ReinforcementLearningTrajectories = "6486599b-a3cd-4e92-a99a-2cea90cc8c3c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[weakdeps]
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"

[extensions]
UnicodePlotsExt = "UnicodePlots"

[compat]
AbstractTrees = "0.3, 0.4"
Adapt = "3, 4"
ChainRulesCore = "1"
CircularArrayBuffers = "0.1.12"
Crayons = "4"
Expand Down Expand Up @@ -57,4 +60,4 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"

[targets]
test = ["CommonRLInterface", "CUDA", "cuDNN", "DomainSets", "Metal", "Preferences", "ReinforcementLearningEnvironments", "Test", "UUIDs"]
test = ["CommonRLInterface", "CUDA", "cuDNN", "DomainSets", "Metal", "Preferences", "ReinforcementLearningEnvironments", "Test", "UnicodePlots", "UUIDs"]
18 changes: 18 additions & 0 deletions src/ReinforcementLearningCore/ext/UnicodePlotsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module UnicodePlotsExt
using ReinforcementLearningCore
using UnicodePlots: lineplot, lineplot!

function Base.show(io::IO, hook::TotalRewardPerEpisode{true, F}) where {F<:Number}
if length(hook.rewards) > 0
println(io, lineplot(
hook.rewards,
title="Total reward per episode",
xlabel="Episode",
ylabel="Score",
))
else
println(io, typeof(hook))
end
return
end
end
15 changes: 0 additions & 15 deletions src/ReinforcementLearningCore/src/core/hooks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export AbstractHook,
DoEveryNSteps,
DoOnExit

using UnicodePlots: lineplot, lineplot!
using Statistics: mean, std
using CircularArrayBuffers: CircularVectorBuffer
import ReinforcementLearningBase: RLBase
Expand Down Expand Up @@ -172,20 +171,6 @@ function Base.push!(hook::TotalRewardPerEpisode,
return
end

function Base.show(io::IO, hook::TotalRewardPerEpisode{true, F}) where {F<:Number}
if length(hook.rewards) > 0
println(io, lineplot(
hook.rewards,
title="Total reward per episode",
xlabel="Episode",
ylabel="Score",
))
else
println(io, typeof(hook))
end
return
end

function Base.push!(hook::TotalRewardPerEpisode{true, F},
::PostExperimentStage,
agent::AbstractPolicy,
Expand Down
1 change: 1 addition & 0 deletions src/ReinforcementLearningCore/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Test
using UnicodePlots
using UUIDs
using Preferences

Expand Down
Loading