gmmsd | R Documentation |
This function implements the GMMSD method for feature extraction. It solves a generalized eigenvalue problem to find a projection that maximizes the difference between the between-class scatter and a scaled within-class scatter. The method uses a QR decomposition to enhance computational efficiency, making it suitable for high-dimensional data.
gmmsd(X, y, c = 1, dim = 2, preproc = multivarious::center())
X |
A numeric matrix (n x d), where n is the number of samples (rows) and d is the number of features (columns). |
y |
A factor or numeric vector of length n representing class labels for each sample. If numeric, it will be internally converted to a factor. |
c |
A numeric balance parameter scaling the within-class scatter matrix. Typically a positive value. Default is 1. |
dim |
The number of dimensions (features) to retain in the transformed feature space. |
preproc |
A |
A discriminant_projector
object (subclass can be "gmmsd"
) containing:
v
: A d x dim
loading/projection matrix.
s
: An n x dim
score matrix (the data projected onto the new axes).
sdev
: Standard deviations of each dimension in s
.
labels
: The class labels.
preproc
: The preprocessing object used.
## Not run:
library(multivarious)
data(iris)
X <- as.matrix(iris[, -5])
y <- iris$Species
# By default, this will center the data prior to GMMSD
dp <- gmmsd(X, y, c = 1, dim = 2)
# Inspect the projector
print(dp)
# Project the original data
scores <- dp$s
# or equivalently, project(dp, X)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.