diff --git a/README.adoc b/README.adoc index 48b234b..2b676ab 100644 --- a/README.adoc +++ b/README.adoc @@ -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] ---- diff --git a/analysis/mean_kappa.jl b/analysis/mean_kappa.jl index 6ae790e..7c74438 100644 --- a/analysis/mean_kappa.jl +++ b/analysis/mean_kappa.jl @@ -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) diff --git a/src/RL/latex_table.jl b/src/RL/latex_table.jl index ccdc3dd..18b19b5 100644 --- a/src/RL/latex_table.jl +++ b/src/RL/latex_table.jl @@ -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]