Package 'woylier'

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

Help Index


Overlay paths of interpolation on the sphere

Description

Overlay paths of interpolation on the sphere

Usage

add_path(proj_space, path)

Arguments

proj_space

n number of points on the surface of sphere

path

interpolated path

Value

data frame with interpolated path and points on sphere surface

Examples

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

Description

Generate the background sphere or torus

Usage

generate_space_view(n = 1000, p = 3, d = 1)

Arguments

n

number of points on the sphere

p

dimension of data

d

dimension of projection

Value

n number of points on the surface of sphere

Examples

p <- 4
sp <- generate_space_view(p=p)

Construct full interpolated frames

Description

Construct full interpolated frames

Usage

givens_full_path(Fa, Fz, nsteps)

Arguments

Fa

starting pxd frame

Fz

target pxd frame

nsteps

number of steps of interpolation

Value

array with nsteps+1 matrices. Each matrix is interpolated frame in between starting and target frames.

Examples

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

Description

Create a grand tour with Givens interpolation

Usage

grand_tour_givens(d = 2, ...)

Arguments

d

dimension of projection

...

additional parameters to pass through

Value

creates grand tour

Examples

data(sine_curve)
tourr::animate(sine_curve, woylier::grand_tour_givens(), tourr::display_xy())

Create a guided tour with Givens interpolation

Description

Create a guided tour with Givens interpolation

Usage

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,
  ...
)

Arguments

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: search_geodesic, search_better, search_better_random, search_polish. Default is search_geodesic.

n_sample

number of samples to generate if search_f is search_polish

...

arguments sent to the search_f

Value

creates guided tour

Examples

data(sine_curve)
tourr::animate_xy(sine_curve, guided_tour_givens(tourr::splines2d()), sphere=FALSE)

A planned tour path using frame-to-frame interpolation.

Description

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).

Usage

planned_tour_givens(basis_set, cycle = FALSE)

Arguments

basis_set

the set of bases as a list of projection matrices or a 3d array

cycle

cycle through continuously (TRUE) or stop after first pass (FALSE)

Details

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().

Value

creates planned tour path

See Also

The tourr::little_tour(), a special type of planned tour which cycles between all axis parallel projections.

Examples

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))

Simulated 6D data with a sine curve

Description

The data has 6 columns, labelled V1-V6, where the sine curve is in V5, V6. The other columns are normal samples.

Format

A 500x6 data frame

Examples

library(woylier)
data(sine_curve)
plot(sine_curve$V5, sine_curve$V6)