Compute index values for a tour history.
path_index(history, index_f, data = attr(history, "data"))
list of bases produced by save_history
(or otherwise)
index function to apply to each basis
dataset to be projected on to bases
save_history
for options to save history
fl_holes <- save_history(flea[, 1:6], guided_tour(holes()), sphere = TRUE)
#> Converting input data to the required matrix format.
#> Value 0.856 5.2 % better - NEW BASIS
#> Value 0.883 3.2 % better - NEW BASIS
#> Value 0.890 0.8 % better - NEW BASIS
#> Value 0.892 0.3 % better - NEW BASIS
#> Value 0.899 0.7 % better - NEW BASIS
#> Value 0.903 0.4 % better - NEW BASIS
#> Value 0.904 0.1 % better
#> Value 0.906 0.4 % better - NEW BASIS
#> Value 0.907 0.1 % better
#> Value 0.908 0.2 % better - NEW BASIS
#> Value 0.909 0.1 % better - NEW BASIS
#> Value 0.911 0.2 % better - NEW BASIS
#> Value 0.915 0.4 % better - NEW BASIS
#> Value 0.918 0.4 % better - NEW BASIS
#> Value 0.919 0.1 % better
#> Value 0.919 0.1 % better - NEW BASIS
#> Value 0.920 0.1 % better
#> Value 0.920 0.1 % better - NEW BASIS
#> Value 0.922 0.1 % better - NEW BASIS
#> Value 0.922 0.0 % better
#> Value 0.922 0.0 % better
#> Value 0.923 0.1 % better - NEW BASIS
#> Value 0.924 0.1 % better
#> Value 0.923 0.0 % better
#> Value 0.924 0.1 % better - NEW BASIS
#> Value 0.924 0.0 % better
#> Value 0.925 0.1 % better - NEW BASIS
#> Value 0.925 0.0 % better
#> Value 0.926 0.1 % better - NEW BASIS
#> Value 0.927 0.1 % better - NEW BASIS
#> Value 0.930 0.3 % better - NEW BASIS
#> Value 0.931 0.1 % better
#> Value 0.931 0.1 % better
#> Value 0.932 0.2 % better - NEW BASIS
#> Value 0.933 0.1 % better
#> Value 0.933 0.2 % better - NEW BASIS
#> Value 0.934 0.0 % better
#> Value 0.934 0.1 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.1 % better
#> Value 0.934 0.1 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.0 % better
#> Value 0.934 0.1 % better
#> Value 0.934 0.0 % better
#> Value 0.935 0.1 % better - NEW BASIS
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.0 % better
#> Value 0.935 0.1 % better
#> Value 0.935 0.0 % better
#> No better bases found after 25 tries. Giving up.
#> Final projection:
#> -0.102 0.960
#> -0.836 0.031
#> 0.085 0.121
#> -0.181 0.039
#> -0.455 -0.245
#> -0.210 -0.046
path_index(fl_holes, holes())
#> [1] 0.8131522 0.8555257 0.8826982 0.8899170 0.8924648 0.8990949 0.9028726
#> [8] 0.9064484 0.9080788 0.9094344 0.9110685 0.9146181 0.9179657 0.9191304
#> [15] 0.9203588 0.9216977 0.9227311 0.9238004 0.9248211 0.9259350 0.9269204
#> [22] 0.9301253 0.9320167 0.9334850 0.9345782 0.9345782
#> attr(,"class")
#> [1] "path_index"
## path_index(fl_holes, cmass())
plot(path_index(fl_holes, holes()), type = "l")
## plot(path_index(fl_holes, cmass()), type = "l")
# \donttest{
# Use interpolate to show all intermediate bases as well
hi <- path_index(interpolate(fl_holes), holes())
hi
#> [1] 0.8131522 0.8180359 0.8228032 0.8273943 0.8317546 0.8358345 0.8395915
#> [8] 0.8429897 0.8460011 0.8486053 0.8507900 0.8525507 0.8538907 0.8548205
#> [15] 0.8553576 0.8555259 0.8555257 0.8575674 0.8596487 0.8617680 0.8639189
#> [22] 0.8660903 0.8682647 0.8704186 0.8725222 0.8745401 0.8764322 0.8781552
#> [29] 0.8796639 0.8809133 0.8818603 0.8824660 0.8826969 0.8826982 0.8847959
#> [36] 0.8865471 0.8879411 0.8889696 0.8896260 0.8899061 0.8899170 0.8911751
#> [43] 0.8920269 0.8924338 0.8924648 0.8942415 0.8957432 0.8969665 0.8979104
#> [50] 0.8985765 0.8989691 0.8990949 0.9002880 0.9012775 0.9020450 0.9025719
#> [57] 0.9028405 0.9028726 0.9038848 0.9047363 0.9054216 0.9059359 0.9062749
#> [64] 0.9064352 0.9064484 0.9074341 0.9079709 0.9080788 0.9089745 0.9093976
#> [71] 0.9094344 0.9102558 0.9107963 0.9110490 0.9110685 0.9126395 0.9137617
#> [78] 0.9144232 0.9146181 0.9161469 0.9172253 0.9178313 0.9179657 0.9188412
#> [85] 0.9191304 0.9198861 0.9202876 0.9203588 0.9211080 0.9215536 0.9216977
#> [92] 0.9224912 0.9227311 0.9233601 0.9237212 0.9238004 0.9245162 0.9248127
#> [99] 0.9248211 0.9256863 0.9259350 0.9266815 0.9269204 0.9269204 0.9280400
#> [106] 0.9289359 0.9295928 0.9299947 0.9301253 0.9312846 0.9319046 0.9320167
#> [113] 0.9328821 0.9333799 0.9334850 0.9341808 0.9345334 0.9345782
#> attr(,"class")
#> [1] "path_index"
plot(hi)
# }