Title: | Alternative Tour Frame Interpolation Method |
---|---|
Description: | This method generates a tour path by interpolating between d-D frames in p-D using Givens rotations. The algorithm arises from the problem of zeroing elements of a matrix. This interpolation method is useful for showing specific d-D frames in the tour, as opposed to d-D planes, as done by the geodesic interpolation. It is useful for projection pursuit indexes which are not s invariant. See more details in Buj, Cook, Asimov and Hurley (2005) <doi:10.1016/S0169-7161(04)24014-7> and Batsaikhan, Cook and Laa (2023) <doi:10.48550/arXiv.2311.08181>. |
Authors: | Zola Batsaikan [aut] , Dianne Cook [aut, cre] , Ursula Laa [aut] |
Maintainer: | Dianne Cook <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.9 |
Built: | 2024-11-04 21:43:29 UTC |
Source: | https://github.com/numbats/woylier |
Overlay paths of interpolation on the sphere
add_path(proj_space, path)
add_path(proj_space, path)
proj_space |
n number of points on the surface of sphere |
path |
interpolated path |
data frame with interpolated path and points on sphere surface
p <- 4 base1 <- tourr::basis_random(p, d=1) base2 <- tourr::basis_random(p, d=1) path <- woylier::givens_full_path(base1, base2, nsteps=10) sp <- woylier::generate_space_view(p=p) sp_path <- woylier::add_path(sp, path) tourr::animate_xy(sp_path[,1:4], col=sp_path$type)
p <- 4 base1 <- tourr::basis_random(p, d=1) base2 <- tourr::basis_random(p, d=1) path <- woylier::givens_full_path(base1, base2, nsteps=10) sp <- woylier::generate_space_view(p=p) sp_path <- woylier::add_path(sp, path) tourr::animate_xy(sp_path[,1:4], col=sp_path$type)
Generate the background sphere or torus
generate_space_view(n = 1000, p = 3, d = 1)
generate_space_view(n = 1000, p = 3, d = 1)
n |
number of points on the sphere |
p |
dimension of data |
d |
dimension of projection |
n number of points on the surface of sphere
p <- 4 sp <- generate_space_view(p=p)
p <- 4 sp <- generate_space_view(p=p)
Construct full interpolated frames
givens_full_path(Fa, Fz, nsteps)
givens_full_path(Fa, Fz, nsteps)
Fa |
starting pxd frame |
Fz |
target pxd frame |
nsteps |
number of steps of interpolation |
array with nsteps+1 matrices. Each matrix is interpolated frame in between starting and target frames.
p <- 4 base1 <- tourr::orthonormalise(tourr::basis_random(p, d=1)) base2 <- tourr::orthonormalise(tourr::basis_random(p, d=1)) path <- woylier::givens_full_path(base1, base2, nsteps=10)
p <- 4 base1 <- tourr::orthonormalise(tourr::basis_random(p, d=1)) base2 <- tourr::orthonormalise(tourr::basis_random(p, d=1)) path <- woylier::givens_full_path(base1, base2, nsteps=10)
Create a grand tour with Givens interpolation
grand_tour_givens(d = 2, ...)
grand_tour_givens(d = 2, ...)
d |
dimension of projection |
... |
additional parameters to pass through |
creates grand tour
data(sine_curve) tourr::animate(sine_curve, woylier::grand_tour_givens(), tourr::display_xy())
data(sine_curve) tourr::animate(sine_curve, woylier::grand_tour_givens(), tourr::display_xy())
Create a guided tour with Givens interpolation
guided_tour_givens( index_f, d = 2, alpha = 0.5, cooling = 0.99, max.tries = 25, max.i = Inf, optim = "search_geodesic", n_sample = 100, ... )
guided_tour_givens( index_f, d = 2, alpha = 0.5, cooling = 0.99, max.tries = 25, max.i = Inf, optim = "search_geodesic", n_sample = 100, ... )
index_f |
the index function to optimize. |
d |
target dimensionality |
alpha |
the initial size of the search window, in radians |
cooling |
the amount the size of the search window should be adjusted by after each step |
max.tries |
the maximum number of unsuccessful attempts to find a better projection before giving up |
max.i |
the maximum index value, stop search if a larger value is found |
optim |
character indicating the search strategy to use: |
n_sample |
number of samples to generate if |
... |
arguments sent to the search_f |
creates guided tour
data(sine_curve) tourr::animate_xy(sine_curve, guided_tour_givens(tourr::splines2d()), sphere=FALSE)
data(sine_curve) tourr::animate_xy(sine_curve, guided_tour_givens(tourr::splines2d()), sphere=FALSE)
The planned tour takes you from one basis to the next in a
set order. Once you have visited all the planned bases, you either stop
or start from the beginning once more (if cycle = TRUE
).
planned_tour_givens(basis_set, cycle = FALSE)
planned_tour_givens(basis_set, cycle = FALSE)
basis_set |
the set of bases as a list of projection matrices or a 3d array |
cycle |
cycle through continuously ( |
Usually, you will not call this function directly, but will pass it to
a method that works with tour paths like tour::animate()
,
tourr::save_history()
or tourr::render()
.
creates planned tour path
The tourr::little_tour()
, a special type of planned tour
which cycles between all axis parallel projections.
library(tourr) twod <- save_history(flea[, 1:3], max = 5) str(twod) tourr::animate_xy(flea[, 1:3], woylier::planned_tour_givens(twod)) tourr::animate_xy(flea[, 1:3], woylier::planned_tour_givens(twod, TRUE)) oned <- tourr::save_history(flea[, 1:6], tourr::grand_tour(1), max = 3) tourr::animate_dist(flea[, 1:6], woylier::planned_tour_givens(oned))
library(tourr) twod <- save_history(flea[, 1:3], max = 5) str(twod) tourr::animate_xy(flea[, 1:3], woylier::planned_tour_givens(twod)) tourr::animate_xy(flea[, 1:3], woylier::planned_tour_givens(twod, TRUE)) oned <- tourr::save_history(flea[, 1:6], tourr::grand_tour(1), max = 3) tourr::animate_dist(flea[, 1:6], woylier::planned_tour_givens(oned))
The data has 6 columns, labelled V1-V6, where the sine curve is in V5, V6. The other columns are normal samples.
A 500x6 data frame
library(woylier) data(sine_curve) plot(sine_curve$V5, sine_curve$V6)
library(woylier) data(sine_curve) plot(sine_curve$V5, sine_curve$V6)