update_classes_wb: Weight-based class updates

View source: R/RcppExports.R

update_classes_wbR Documentation

Weight-based class updates

Description

Weight-based class updates

Usage

update_classes_wb(
  s,
  b,
  Omega,
  epsmin = 0.01,
  epsmax = 0.7,
  deltamin = 0.1,
  deltashift = 0.5,
  identify_classes = FALSE,
  Cmax = 10L
)

Arguments

s

[numeric(C)]
The vector of class weights.

b

[matrix(nrow = P_r, ncol = C)]
The matrix of class means as columns.

Omega

[matrix(nrow = P_r * P_r, ncol = C)]
The matrix of vectorized class covariance matrices as columns.

epsmin

[numeric(1)]
The threshold weight for removing a class.

epsmax

[numeric(1)]
The threshold weight for splitting a class.

deltamin

[numeric(1)]
The threshold difference in class means for joining two classes.

deltashift

[numeric(1)]
The scale for shifting the class means after a split.

identify_classes

[logical(1)]
Identify classes by decreasing class weights?

Cmax

[integer(1)]
The maximum number of classes, used to allocate space.

Details

The following updating rules apply:

  • Class c is removed if s_c < \epsilon_{min}.

  • Class c is split into two classes, if s_c > \epsilon_{max}.

  • Two classes c_1 and c_2 are merged to one class, if ||b_{c_1} - b_{c_2}|| < \delta_{min}.

Value

A list of updated values for s, b, and Omega and the indicator update_type which signals the type of class update:

  • 0: no update

  • 1: removed class

  • 2: split class

  • 3: merged classes

Examples

s <- c(0.7, 0.3)
b <- matrix(c(1, 1, 1, -1), ncol = 2)
Omega <- matrix(c(0.5, 0.3, 0.3, 0.5, 1, -0.1, -0.1, 0.8), ncol = 2)

### no update
update_classes_wb(s = s, b = b, Omega = Omega)

### remove class 2
update_classes_wb(s = s, b = b, Omega = Omega, epsmin = 0.31)

### split class 1
update_classes_wb(s = s, b = b, Omega = Omega, epsmax = 0.69)

### merge classes 1 and 2
update_classes_wb(s = s, b = b, Omega = Omega, deltamin = 3)


RprobitB documentation built on Aug. 26, 2025, 1:08 a.m.