Skip to contents

The eras of a history: the split of its versions into k runs of consecutive versions that are as alike as possible inside each run. Exact (dynamic programming) for the criterion of k-means: the sum, over the eras, of the distances between every two versions of the era (vp_version_distance()) divided by the number of its versions. A boundary between two eras is where the model changed course.

Usage

vp_eras(history, k = 3, graph = c("requires", "excludes", "atleastone"))

Arguments

history

A history: the versions of a model, from vp_read_history() or vp_history(), oldest first.

k

The number of eras.

graph

Which graph: "requires", "excludes" or "atleastone" (the last one needs or_graph = TRUE in vp_generate()).

Value

A tibble with version, era (1 to k) and spread (the mean distance between the versions of its era).

Examples

gens <- c("miband1", "miband2", "miband3", "miband4", "miband6")
history <- vp_history(
  vp_example(paste0(gens, "_realized.uvl")),
  versions = gens,
  or_graph = TRUE
)
vp_eras(history, k = 2)
#> # A tibble: 5 × 3
#>   version   era spread
#>   <fct>   <int>  <dbl>
#> 1 miband1     1  0.323
#> 2 miband2     1  0.323
#> 3 miband3     1  0.323
#> 4 miband4     1  0.323
#> 5 miband6     2  0