This is a convenience method that returns a data frame summarising the index values for multiple tour paths.

paths_index(bases_list, index_f)

Arguments

bases_list

list of histories produced by save_history

index_f

index function to apply to each projection

Examples

# The max.tries is low for satisfying CRAN checks
# Increase it for using in practice
holes1d <- guided_tour(holes(), 1, max.tries=2)
# Perform guided tour 5 times, saving results
tries <- replicate(5, save_history(flea[, 1:6], holes1d), simplify = FALSE)
#> Converting input data to the required matrix format.
#> Value  2.541   0.0 % better 
#> No better bases found after 2 tries.  Giving up.
#> Final projection: 
#> 0.517  -0.420  0.661  -0.330  0.059  0.079  
#> Converting input data to the required matrix format.
#> Value  2.541   5.8 % better  - NEW BASIS
#> Value  2.541   0.0 % better 
#> No better bases found after 2 tries.  Giving up.
#> Final projection: 
#> -0.212  -0.208  0.333  0.551  0.084  0.700  
#> Converting input data to the required matrix format.
#> Value  2.541   0.0 % better 
#> No better bases found after 2 tries.  Giving up.
#> Final projection: 
#> 0.585  0.689  0.190  0.124  -0.318  0.173  
#> Converting input data to the required matrix format.
#> Value  2.541   7.5 % better  - NEW BASIS
#> Value  2.541   0.0 % better 
#> No better bases found after 2 tries.  Giving up.
#> Final projection: 
#> 0.411  -0.201  -0.550  0.145  -0.683  -0.010  
#> Converting input data to the required matrix format.
#> Value  2.541   0.0 % better 
#> No better bases found after 2 tries.  Giving up.
#> Final projection: 
#> 0.254  0.533  0.631  0.458  -0.168  -0.123  
# Interpolate between target bases
itries <- lapply(tries, interpolate)

paths <- paths_index(itries, holes())
head(paths)
#>   try step    value  improvement
#> 1   1    1 2.541494  0.000000000
#> 2   2    1 2.401972  0.000000000
#> 3   2    2 2.492944  0.090971575
#> 4   2    3 2.442931 -0.050012650
#> 5   2    4 2.434656 -0.008275526
#> 6   2    5 2.541494  0.106838499

if (require(ggplot2)) {
  ggplot(data = paths, aes(x=step, y=value, group = try)) + geom_line()
  ## ggplot(data = paths, aes(x=step, y=improvement, group = try)) + geom_line()
}