Title: | Dynamic Programming for Convex Clustering |
---|---|
Description: | Use dynamic programming method to solve l1 convex clustering with identical weights. |
Authors: | Bingyuan Zhang, Jie Chen, Yoshikazu Terada |
Maintainer: | Bingyuan Zhang <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-11-05 03:56:40 UTC |
Source: | https://github.com/bingyuan-zhang/dpcc |
L1 convex clustering with a single lambda.
cdp(X, lam)
cdp(X, lam)
X |
a data matrix of n * p or a data vector with length n. |
lam |
a tuning parameter. |
A list with length p equal to the dimension of the data matrix. Each dimension includes a vector of the estimated centroids.
the estimated centroids.
# generate a data matrix with n = 10 and p = 2. X = matrix(rnorm(10*2), 10, 2) lam = find_lambda(X)/2 # set a tuning parameter lambda. cdp(X, lam)
# generate a data matrix with n = 10 and p = 2. X = matrix(rnorm(10*2), 10, 2) lam = find_lambda(X)/2 # set a tuning parameter lambda. cdp(X, lam)
L1 convex clustering with a lambda sequence.
cpaint(X, lam)
cpaint(X, lam)
X |
a data matrix of n * p or a data vector with length n. |
lam |
a sequence of lambdas. |
A list with length p equal to the dimension of the data matrix. Each dimension includes a sequence of vectors. Each vector includes the estimated centroids with a certain tuning parameter lambda.
A sequence of estimated centroids.
# generate a data matrix with n = 10 and p = 2. X = matrix(rnorm(10*2), 10, 2) # set the biggest lambda in the sequence. lam_max = find_lambda(X) # set the length of the sequence. K = 10 # equally separate the sequence with K. Lam = sapply(1:K, function(i) i/K*lam_max) cpaint(X,Lam)
# generate a data matrix with n = 10 and p = 2. X = matrix(rnorm(10*2), 10, 2) # set the biggest lambda in the sequence. lam_max = find_lambda(X) # set the length of the sequence. K = 10 # equally separate the sequence with K. Lam = sapply(1:K, function(i) i/K*lam_max) cpaint(X,Lam)
Return the lambda which causes all the points become fused into one cluster.
find_lambda(X)
find_lambda(X)
X |
data matrix of n * p |
the biggest lambda
X = matrix(rnorm(3*2), 3, 2) find_lambda(X)
X = matrix(rnorm(3*2), 3, 2) find_lambda(X)