Skip to content

Commit

Permalink
experimenting with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
korilium committed Jul 27, 2024
1 parent 46f36ef commit 6d82ad9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReinforcementLearning = "158674fc-8238-5cab-b5ba-03dfc80d1318"
ReinforcementLearningTrajectories = "6486599b-a3cd-4e92-a99a-2cea90cc8c3c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"

Expand Down
13 changes: 7 additions & 6 deletions reinforecementLearning/K-armed Bandit.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ReinforcementLearning
using ReinforcementLearning, ReinforcementLearningTrajectories
using Plots

# ╔═╡ 1fcd93f0-4a5c-11eb-252d-9da5bc78b08b
Expand All @@ -23,18 +23,19 @@ init=0.0
opt= InvDecay(1.0)
agent= Agent(
policy=QBasedPolicy(
learner= MCLearner(
approximator= TabularQApproximator(
learner= TabularQApproximator(
n_state= length(state_space(env)),
n_action=length(action_space(env)),
init= init,

),
y=1.0
),
),
explorer=explorer
),
trajectory=VectorSARTTrajectory()
)
h1 = CollectBestAction(;best_Action=findmax(env.true_values)[2])
h2 = TotalRewardPerEpisode(;is_display_on_exit=false)



t = Trajectory(Traces(a=Int[], b=Bool[]), BatchSampler(3), InsertSampleRatioControler(1.0, 3));
17 changes: 17 additions & 0 deletions reinforecementLearning/One-dimensionalRandomWalk.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using ReinforcementLearning


env = RandomWalk1D()


state_space(env)

action_space(env)


state(env)

is_terminated(env)


rand(2)

0 comments on commit 6d82ad9

Please sign in to comment.