Description Usage Arguments Value Author(s) Examples
cvxclust_ama
performs convex clustering via AMA. This is an R wrapper function around C code.
Dimensions of various arguments are as follows:
n is the number of data points
p is the number of features
k is the number non-zero weights.
Note that the indices matrices 'M1', 'M2', and 'ix' take on values starting at 0 to match the indexing conventions of C.
1 2 | cvxclust_ama(X, Lambda, ix, M1, M2, s1, s2, w, gamma, nu, type = 2,
max_iter = 100, tol = 1e-04, accelerate = TRUE)
|
X |
The p-by-n data matrix whose columns are to be clustered. |
Lambda |
The p-by-k matrix of Lagrange multipliers. |
ix |
The k-by-2 matrix of index pairs. |
M1 |
Index set used to track nonzero weights. |
M2 |
Index set used to track nonzero weights. |
s1 |
Index set used to track nonzero weights. |
s2 |
Index set used to track nonzero weights. |
w |
A vector of k positive weights. |
gamma |
The regularization parameter controlling the amount of shrinkage. |
nu |
The initial step size parameter when backtracking is applied. Otherwise it is a fixed step size in which case there are no guarantees of convergence if it exceeds |
type |
An integer indicating the norm used: 1 = 1-norm, 2 = 2-norm. |
max_iter |
The maximum number of iterations. |
tol |
The convergence tolerance. |
accelerate |
If |
U
A list of centroid matrices.
V
A list of centroid difference matrices.
Lambda
A list of Lagrange multiplier matrices.
nu
The final step size used.
primal
The primal objective evaluated at the final iterate.
dual
The dual objective evaluated at the final iterate.
iter
The number of iterations taken.
Eric C. Chi, Kenneth Lange
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Create random problem
seed <- 12345
p <- 10
n <- 20
rnd_problem <- create_clustering_problem(p,n,seed)
X <- rnd_problem$X
ix <- rnd_problem$ix
M1 <- rnd_problem$M1
M2 <- rnd_problem$M2
s1 <- rnd_problem$s1
s2 <- rnd_problem$s2
w <- rnd_problem$w
nK <- nrow(ix)
Lambda <- matrix(rnorm(p*nK),p,nK)
gamma <- 0.1
nu <- 1.999/n
max_iter <- 1e6
tol <- 1e-15
sol_ama <- cvxclust_ama(X,Lambda,ix,M1,M2,s1,s2,w,gamma,nu,max_iter=max_iter,tol=tol)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.