Learn R Programming

flacco (version 1.8)

findNearestPrototype: Find Nearest Prototype

Description

For each cell of the initial design, select the closest observation to its center and use it as a representative for that cell.

Usage

findNearestPrototype(feat.object, dist_meth, mink_p, fast_k, ...)

Arguments

feat.object

[FeatureObject] A feature object as created by createFeatureObject.

dist_meth

[character(1)] Which distance method should be used for computing the distance between two observations? All methods of dist are possible options with "euclidean" being the default.

mink_p

[integer(1)] Value of p in case dist_meth is "minkowski". The default is 2, i.e. the euclidean distance.

fast_k

[numeric(1)] Percentage of elements that should be considered within the nearest neighbour computation. The default is 0.05.

...

[any] Further arguments, which might be used within the distance computation (dist).

Value

[data.frame]. A data.frame containing one prototype (i.e. a representative observation) per cell. Each prototype consists of its values from the decision space, the corresponding objective value, its own cell ID and the cell ID of the cell, which it represents.

Examples

Run this code
# NOT RUN {
# (1) create the initial sample and feature object:
X = createInitialSample(n.obs = 1000, dim = 2,
  control = list(init_sample.lower = -10, init_sample.upper = 10))
feat.object = createFeatureObject(X = X, 
  fun = function(x) sum(x^2), blocks = 10)

# (2) find the nearest prototypes of all cells:
findNearestPrototype(feat.object)
# }

Run the code above in your browser using DataLab