View source: R/belief_trajectory.R
| trajectory_metrics | R Documentation |
Computes all trajectory-level metrics for a belief trajectory: entropy at each step, per-step Kullback-Leibler divergence (Bayesian surprise), cumulative divergence from the prior, per-step total-variation distance, total path length, and a family of concentration indices (max/sum, Herfindahl, Shannon-based).
trajectory_metrics(traj_matrix)
traj_matrix |
Matrix. Output from |
A list with components:
entropyNumeric vector of length T+1: Shannon
entropy at each step.
kl_stepNumeric vector of length T: per-step
Kullback-Leibler divergence D_{\mathrm{KL}}(P_t \| P_{t-1}),
equivalently Bayesian surprise (Itti & Baldi, 2009).
kl_from_priorNumeric vector of length T+1:
cumulative Kullback-Leibler divergence from the prior,
D_{\mathrm{KL}}(P_t \| P_0).
tv_stepNumeric vector of length T: per-step
total-variation distance \mathrm{TV}(P_t, P_{t-1}).
path_lengthNumeric scalar. Total path length in
total-variation distance, \sum_t \mathrm{TV}(P_t, P_{t-1}).
concentrationNumeric scalar. Max/sum concentration
index based on per-step information gains (see
concentration_index).
concentration_herfindahlNumeric scalar. Herfindahl
concentration (see herfindahl_index).
concentration_shannonNumeric scalar. Shannon-based
concentration (see shannon_concentration).
Marsico, F. L. & Egeland, T. (in preparation). Belief dynamics during the investigative process. Itti, L. & Baldi, P. (2009). Bayesian surprise attracts human attention. Vision Research 49, 1295-1306.
belief_trajectory,
entropy_log10,
kl_divergence_log10,
concentration_index.
prior <- c(0.5, 0.5)
lrs <- list(c(3, 1), c(1, 2), c(2, 1))
traj <- belief_trajectory(prior, lrs)
metrics <- trajectory_metrics(traj)
str(metrics)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.