troppca.linsp2poly {Rtropical} | R Documentation |
Tropical Principal Component Analysis by Polytope Converted from Linear Space
Description
Approximate the principal component as a tropical polytope converted from tropical linear space for a given data matrix
via MCMC and return the results as an object of class troppca
.
Usage
troppca.linsp2poly(x, pcs = 2, nsample = 1000, ncores = 2)
Arguments
x |
a data matrix, of size n x e, with each row an observation vector. e is the dimension of the tropical space#' |
pcs |
a numeric value indicating the order of principal component. (default: 2) |
nsample |
a numeric value indicating the number of samples of MCMC. (default: 1000) |
ncores |
a numeric value indicating the number of threads utilized for multi-cored CPUs. (default: 2) |
Value
A list of S3 class "troppca"
, including:
pc |
The principal component as a tropical linear space |
obj |
The tropical PCA objective, the sum of tropical distance from each point to the projection. |
projection |
The projections of all data points. |
type |
The geometry of principal component. |
Examples
library(Rfast)
n <- 50
e <- 50
s <- 5
x <- rbind(
rmvnorm(n, mu = c(5, -5, rep(0, e - 2)), sigma = diag(s, e)),
rmvnorm(n, mu = c(-5, 5, rep(0, e - 2)), sigma = diag(s, e))
)
troppca_fit <- troppca.linsp2poly(x)