weightedss: Weighted sum-of-squares criteria

Description Usage Arguments Value Examples

View source: R/weightedss.R

Description

This function computes various weighted sum-of-squares criteria for a given partition of a dataset described by numerical features.

Usage

1
weightedss(X, cl, w = NULL)

Arguments

X

a matrice or a dataframe of size n (observations) by p (variables) with numerical features only.

cl

a vector of integers of length n. It contains the cluster membership of the data.

w

a numerical vector of length p. It contains the weights to be applied to the features. By default, w=NULL, which amounts to setting each weight equal to 1.

Value

bss.per.feature

a numerical vector of length p containing the weighted between sum-of-squares per feature.

wss.per.feature

a numerical vector of length p containing the weighted within sum-of-squares per feature.

bss.per.cluster

a numerical vector of length K (K is the number of clusters) containing the weighted between sum-of-squares per cluster.

wss.per.cluster

a numerical vector of length K containing the weighted within sum-of-squares per cluster.

bss

a scalar representing the weighted between sum-of-squares of the partition. It may be computed as the sum over bss.per.feature or bss.per.cluster.

wss

a scalar representing the weighted within sum-of-squares of the partition. It may be computed as the sum over wss.per.feature or wss.per.cluster.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(iris)
out <- weightedss(X = iris[,1:4], cl = as.numeric(iris$Species))
out$bss.per.feature
out$bss.per.cluster
out$bss

w <- c(0.3,0.3,0.2,0.2)
out <- weightedss(X = iris[,1:4], cl = as.numeric(iris$Species), w=w)
out$bss.per.feature
out$bss.per.cluster
out$bss

vimpclust documentation built on Jan. 8, 2021, 5:34 p.m.