Plot the pathways whose history changes the prediction most
Source:R/plot_pathways.R
plot_divergence.Rdplot_divergence() ranks pathways by the Kullback-Leibler divergence,
in bits, between their next-state distribution and that of their shorter
suffix, the context without the earliest state. In a variable-order model a
longer history matters only where it changes what is expected next. Each
pathway is a lollipop whose point size is its count; points are colored by
whether the most likely next state differs from the suffix's, and those
pathways are annotated with the new most likely state and its probability.
The chart identifies the histories that carry information a shorter memory
would lose.
The pathways are those returned by divergent_pathways().
A large divergence on a small count can be a sampling accident; check
reproducibility with bootstrap_pathways(), and the
pruning decision for one pathway with plot_pruning().
Conditions
transitiontrees_bad_input(error)
treeis not atransitiontreesobject.transitiontrees_empty_result(error) no pathway reaches
min_count.
See also
divergent_pathways() for the table;
plot_pathways(), plot_pruning(),
bootstrap_pathways().
Examples
tree <- context_tree(trajectories, max_depth = 3)
plot_divergence(tree, top = 10)