Instead of choosing new projections at random like the grand tour, the guided tour always tries to find a projection that is more interesting than the current projection.
guided_tour(
index_f,
d = 2,
alpha = 0.5,
cooling = 0.99,
max.tries = 25,
max.i = Inf,
search_f = search_geodesic,
n_sample = 100,
...
)
the index function to optimise.
target dimensionality
the initial size of the search window, in radians
the amount the size of the search window should be adjusted by after each step
the maximum number of unsuccessful attempts to find a better projection before giving up
the maximum index value, stop search if a larger value is found
the search strategy to use: search_geodesic
, search_better
,
search_better_random
, search_polish
. Default is search_geodesic
.
number of samples to generate if search_f
is search_polish
arguments sent to the search_f
Currently the index functions only work in 2d.
Usually, you will not call this function directly, but will pass it to
a method that works with tour paths like animate
,
save_history
or render
.
cmass
, holes
and lda_pp
for examples of index functions. The function should take a numeric
matrix and return a single number, preferably between 0 and 1.
search_geodesic
, search_better
,
search_better_random
for different search strategies
flea_std <- apply(flea[,1:6], 2, function(x) (x-mean(x))/sd(x))
animate_xy(flea_std, guided_tour(holes()), sphere = TRUE)
#> Value 0.806 0.7 % better - NEW BASIS
#> Using half_range 3.8
# \donttest{
animate_xy(flea_std, guided_tour(holes(), search_f = search_better_random), sphere = TRUE)
#> Old 0.7954998
#> New 0.8025468 try 1
#> Accept
#> Using half_range 3.8
animate_dist(flea_std, guided_tour(holes(), 1), sphere = TRUE)
#> Value 0.828 6.3 % better - NEW BASIS
#> Using half_range 3.8
animate_xy(flea_std, guided_tour(lda_pp(flea$species)), sphere = TRUE, col = flea$species)
#> Value 0.855 15.0 % better - NEW BASIS
#> Using half_range 3.8
# save_history is particularly useful in conjunction with the
# guided tour as it allows us to look at the tour path in many different
# ways
f <- flea_std[, 1:3]
tries <- replicate(5, save_history(f, guided_tour(holes())), simplify = FALSE)
#> Value 0.909 24.4 % better - NEW BASIS
#> Value 0.972 6.9 % better - NEW BASIS
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.975 -0.012
#> -0.146 0.793
#> 0.171 0.609
#> Value 0.853 28.4 % better - NEW BASIS
#> Value 0.946 10.8 % better - NEW BASIS
#> Value 0.970 2.6 % better - NEW BASIS
#> Value 0.972 0.2 % better - NEW BASIS
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.868 -0.444
#> -0.479 0.626
#> -0.134 0.641
#> Value 0.896 18.5 % better - NEW BASIS
#> Value 0.948 5.8 % better - NEW BASIS
#> Value 0.967 2.0 % better - NEW BASIS
#> Value 0.972 0.5 % better - NEW BASIS
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.712 0.669
#> 0.404 0.639
#> 0.574 0.380
#> Value 0.762 3.2 % better - NEW BASIS
#> Value 0.887 16.4 % better - NEW BASIS
#> Value 0.969 9.2 % better - NEW BASIS
#> Value 0.972 0.4 % better - NEW BASIS
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.415 0.879
#> -0.766 -0.198
#> -0.491 -0.434
#> Value 0.883 18.0 % better - NEW BASIS
#> Value 0.970 9.8 % better - NEW BASIS
#> Value 0.972 0.2 % better - NEW BASIS
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> Value 0.972 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.878 0.447
#> -0.442 -0.620
#> -0.183 -0.645
# }