init: Initialise the membership matrix H or prototype matrix W.

View source: R/Functions.R

initR Documentation

Initialise the membership matrix H or prototype matrix W.

Description

This function initialises the H_{n \times k} matrix or the W_{k \times p} matrix to start the SSMF model. This function is often used in conjunction with the function ssmf( ). Also, the code can be run separately from the function ssmf( ). This function returns to simplex-structured soft membership matrix H and prototype matrix W.

Usage

init(
  data = NULL,
  k = NULL,
  method = c("kmeans", "uniform", "dirichlet", "nmf")
)

Arguments

data

Data matrix or data frame.

k

The number of prototypes/clusters.

method

Character: 'kmeans', 'uniform', 'dirichlet' or 'nmf'. If there are more than one method, the default is selecting the first method in the vector.

Details

'kmeans': create the W matrix using the centres of the kmeans output; create the H matrix by converting the classification into a binary matrix.

'uniform': create the H matrix by sampling the values from uniform distribution and making the rows of the matrix lie in the unit simplex; group the observations with their maximum memberships and create the W matrix by combining the mean vector in each group.

'dirichlet': create the H matrix by sampling the values from Dirichlet distribution; group the observations with their maximum memberships and create the W matrix by combining the mean vector in each group.

'nmf': create the W matrix using the matrix of basic components from NMF model; the coefficient matrix is acquired from NMF model, then the H is created by making the rows of the coefficient matrix lie in the unit simplex.

Value

Initialised H, W matrix.

Author(s)

Wenxuan Liu

Examples

# example code

init(data = SimulatedDataset, k = 4, method = 'kmeans')


MetabolSSMF documentation built on April 3, 2025, 5:44 p.m.