linear_NPCA: Nonnegative Principal Component Analysis

do.npcaR Documentation

Nonnegative Principal Component Analysis

Description

Nonnegative Principal Component Analysis (NPCA) is a variant of PCA where projection vectors - or, basis for learned subspace - contain no negative values.

Usage

do.npca(X, ndim = 2, ...)

Arguments

X

an (n\times p) matrix whose rows are observations and columns represent independent variables.

ndim

an integer-valued target dimension.

...

extra parameters including

maxiter

maximum number of iterations (default: 100).

reltol

relative tolerance stopping criterion (default: 1e-4).

Value

a named Rdimtools S3 object containing

Y

an (n\times ndim) matrix whose rows are embedded observations.

projection

a (p\times ndim) whose columns are basis for projection.

algorithm

name of the algorithm.

Author(s)

Kisung You

References

\insertRef

zafeiriou_nonnegative_2010Rdimtools

See Also

do.pca

Examples

## Not run: 
## use iris data
data(iris, package="Rdimtools")
set.seed(100)
subid = sample(1:150, 50)
X     = as.matrix(iris[subid,1:4]) + 50
label = as.factor(iris[subid,5])

## run NCPA and compare with others
outNPC = do.npca(X)
outPCA = do.pca(X)
outMVP = do.mvp(X, label)

## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(outNPC$Y, pch=19, col=label, main="NPCA")
plot(outPCA$Y, pch=19, col=label, main="PCA")
plot(outMVP$Y, pch=19, col=label, main="MVP")
par(opar)

## End(Not run)


Rdimtools documentation built on Dec. 28, 2022, 1:44 a.m.