genDONUTS: Generate Nested Donuts

Description Usage Arguments Value Examples

View source: R/data_genDONUTS.R

Description

It generates nested donuts, which are just hollow circles. For flexible testing, the parameter k controls the number of circles of varying radii where n controls the number of observations for each circle.

Usage

1
genDONUTS(n = 50, k = 2, sd = 0.1)

Arguments

n

the number of data points for each hollow circle (default: 50).

k

the number of circles (default: 2).

sd

magnitude of white noise (default: 0.1).

Value

a named list containing with m = nk:

data

an (m\times 2) data matrix.

label

a length-m vector(factor) for class labels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## generate data
donut2 = genDONUTS(k=2)
donut3 = genDONUTS(k=3)
donut4 = genDONUTS(k=4)

## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3), pty="s")
plot(donut2$data, col=donut2$label, pch=19, main="k=2")
plot(donut3$data, col=donut3$label, pch=19, main="k=3")
plot(donut4$data, col=donut4$label, pch=19, main="k=4")
par(opar)

T4cluster documentation built on Aug. 16, 2021, 9:07 a.m.