Performs simulated annealing on the index function, solving for it's local extrema. Returns only the last identified basis of the optimization. A truncated, muted extension of tourr::save_history(guided_tour())).

basis_guided(data, index_f = tourr::holes(), d = 2, ...)

Arguments

data

Numeric matrix or data.frame of the observations.

index_f

The index function to optimize. {tourr} exports holes(), cmass(), and lda_pp(class).

d

Number of dimensions in the projection space.

...

Optional, other arguments to pass to tourr::guided_tour

Value

Numeric matrix of the last basis of a guided tour.

See also

tourr::guided_tour for annealing arguments.

Other basis producing functions: basis_half_circle(), basis_odp(), basis_olda(), basis_onpp(), basis_pca()

Examples

dat_std <- scale_sd(wine[, 2:6])
basis_guided(data = dat_std, index_f = tourr::holes())
#>                   [,1]       [,2]
#> Alcohol    -0.66586828 -0.6597440
#> Malic       0.39755534 -0.2436692
#> Ash         0.24771116 -0.5087866
#> Alcalinity  0.57983564 -0.3542445
#> Magnesium   0.03160688 -0.3478652

basis_guided(data = dat_std, index_f = tourr::cmass(),
             alpha = .4, cooling = .9, max.tries = 10, n_sample = 4)
#>                  [,1]       [,2]
#> Alcohol    -0.1750620 -0.2847570
#> Malic      -0.2537527  0.1991293
#> Ash        -0.4822604  0.2238649
#> Alcalinity  0.5413391 -0.5891976
#> Magnesium   0.6159057  0.6942562