Learn R Programming

SFDesign (version 0.1.3)

cluster.error: Clustering error

Description

This function computes the clustering error.

Usage

cluster.error(design, X = NULL, alpha = 1)

Value

clustering error of the design.

Arguments

design

a design matrix.

X

candidate points in \([0,1]^p\). If X is not provided, Sobol points are generated as candidate points.

alpha

power of the Euclidean distance.

Details

cluster.error computes the clustering error. The clustering error for a design \(D=[\bm x_1, \dots, \bm x_n]^T\) is defined as \(\frac{1}{N}\sum_{i=1}^n\sum_{\bm x\in{V_i}}\|\bm x - \bm x_i\|^\alpha\), where \(V_i\) is the Voronoi cell of each design point \(\bm x_i\) for \(i=1,\dots,n\), N is the size of X. When \(\alpha=2\), we obtain K-means and when \(\alpha=1\), we obtain K-medians.

Examples

Run this code
n = 20
p = 3
D = randomLHD(n, p)
cluster.error(D)

Run the code above in your browser using DataLab