1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-12-21 00:51:21 +00:00

mean_kappa documentation

This commit is contained in:
Mo8it 2022-02-08 23:16:38 +01:00
parent 539029c3a1
commit 54f8a1bfaf
3 changed files with 20 additions and 7 deletions

View file

@ -130,7 +130,7 @@ include("src/RL/latex_table.jl")
latex_rl_table(env_helper, FILENAME_WITHOUT_EXTENSION)
----
`FILENAME_WITHOUT_EXTENSION` has to be replaced by the wanted file name without extension of the `.tex` file. The documentation of `latex_rl_table` explains where the output is placed.
`FILENAME_WITHOUT_EXTENSION` has to be replaced by the wanted file name without extension of the `.tex` file. The method's documentation explains where the output is placed.
The output file can be used in a LaTeX document:
@ -164,16 +164,16 @@ To plot the mean of kappa as the ratio of the eigenvalues of the gyration tensor
[source,julia]
----
include("analysis/mean_kappa.jl")
plot_mean_kappa(; rl_dir=rl_dir, n_last_episodes=N_LAST_EPISODES)
plot_mean_κ(; rl_dir=rl_dir, n_last_episodes=N_LAST_EPISODES)
----
`N_LAST_EPISODES` is the number of the last episodes of the learning process to average over.
`N_LAST_EPISODES` is the number of the last episodes of the learning process to average over. The method's documentation explains where the output is placed.
== Run analysis
After running the following command blocks in the REPL, the output can be found in the directory `ReCo.jl/exports/graphics`.
=== Mean squared displacement
=== Mean squared displacement and random walk
[source,julia]
----

View file

@ -6,7 +6,18 @@ using ReCo: ReCo
include("../src/Visualization/common_CairoMakie.jl")
function plot_mean_kappa(; rl_dir::String, n_last_episodes::Int64)
"""
plot_mean_κ(; rl_dir::String, n_last_episodes::Int64)
Plot the mean of `κ` of the learning process at the directory `rl_dir`.
`κ` is the ratio of the eigenvalues of the gyration tensor. `n_last_episodes` is the number of the last episodes of the learning process to average over.
The output is `rl_dir/mean_kappa.pdf`.
Return `nothing`.
"""
function plot_mean_κ(; rl_dir::String, n_last_episodes::Int64)
dir_content = readdir(rl_dir; join=true, sort=true)
n_content = length(dir_content)

View file

@ -1,6 +1,8 @@
using DataFrames: DataFrames
using PrettyTables: pretty_table
using ReCo: ReCo
function latex_table(
dataframe::DataFrames.DataFrame, filename::String; path::String="exports/$filename"
)
@ -12,7 +14,7 @@ function latex_table(
end
"""
latex_rl_table(env_helper, filename_without_extension::String)
latex_rl_table(env_helper::ReCo.RL.EnvHelper, filename_without_extension::String)
Generate a LaTeX table to the Q-matrix of `env_helper`.
@ -20,7 +22,7 @@ The output is `ReCo.jl/exports/filename_without_extension.tex`. `env_helper` has
Return `nothing`.
"""
function latex_rl_table(env_helper, filename_without_extension::String)
function latex_rl_table(env_helper::ReCo.RL.EnvHelper, filename_without_extension::String)
table = copy(env_helper.shared.agent.policy.learner.approximator.table)
for col in 1:size(table)[2]