ClusterEqualWeighting: ClusterEqualWeighting

View source: R/ClusterEqualWeighting.R

ClusterEqualWeightingR Documentation

ClusterEqualWeighting

Description

Weights clusters equally

Usage

ClusterEqualWeighting(Cls, Data, MinClusterSize)

Arguments

Cls

1:n numerical vector of numbers defining the classification as the main output of the clustering algorithm for the n cases of data. It has k unique numbers representing the arbitrary labels of the clustering.

Data

Optional, [1:n,1:d] matrix of dataset consisting of n cases of d-dimensional data points. Every case has d attributes, variables or features.

MinClusterSize

Optional, scalar defining the number of cases m that each cluster should have

Details

Balance clusters such that their sizes are the same by subsampling the larger cluster. If MinClusterSize is missing the number of cases per cluster is set to the smallest cluster size. For clusters sizes smaller than MinClusterSize, sampling with replacement is turned on, i.e. up sampling. For clusters sizes equal to MinClusterSize, no sampling is performed.

Value

List of

BalancedCls

Vector of Cls such that all clusters have the same sizes spezified by MinClusterSize

BalancedInd

index such that BalancedCls = Cls[BalancedInd]

BalancedData

NULL if missing, otherwise, Data[BalancedInd,]

Author(s)

Alfred Ultsch (matlab), reimplemented by Michael Thrun

Examples

data(Hepta)
ClusterEqualWeighting(Hepta$Cls,Hepta$Data,5)

FCPS documentation built on Oct. 19, 2023, 5:06 p.m.