tuneForceRatio: Method to compute optimal ratio between repulsive and...

View source: R/forceTuning.R

tuneForceRatioR Documentation

Method to compute optimal ratio between repulsive and attractive forces for Freeviz.

Description

Method to compute optimal ratio between repulsive and attractive forces for Freeviz.

Usage

tuneForceRatio(
  x,
  classes,
  law = 0,
  steps = 10,
  springs = NULL,
  multilevel = TRUE,
  print = TRUE
)

Arguments

x

Dataframe or matrix, with observations as rows and attributes as columns

classes

Vector with class labels of the observations

law

Integer, specifying how forces change with distance: 0 = (inverse) linear, 1 = (inverse) square

steps

Number of iterations of the algorithm before re-considering convergence criterion

springs

Numeric matrix with initial anchor coordinates. When NULL (=default), springs are initialized by make.S

multilevel

Logical, indicating whether multi-level computation should be used. Setting it to TRUE can speed up computations

print

Logical, indicating whether information on the iterative procedure should be printed in the R console

Details

Running Freeviz, it is hard to know what weights to specify for the attractive and repulsive forces to optimize the projection result. This function runs an iterative procedure to find the optimal force ratio. First, a logarithmic grid search is performed, followed by 1D optimization on the refined interval. This approach is less prone to getting stuck in a suboptimal local optimum, and requires less Freeviz evaluations than direct 1D optimization

Value

Value of the optimal force ratio (attractive force in the nominator)

Author(s)

Nicolas Sauwen

Examples

data(iris)
das <- c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width')
S <- make.S(das)
rv <- do.radviz(iris,S)
plot(rv,anchors.only=FALSE)
forceRatio <- tuneForceRatio(x = iris[,das], classes = iris$Species)
new.S <- do.optimFreeviz(x = iris[,das], classes = iris$Species, attractG = forceRatio, repelG = 1)
new.rv <- do.radviz(iris,new.S)
plot(new.rv,anchors.only=FALSE)


yannabraham/Radviz documentation built on April 3, 2022, 1:30 p.m.