clusterpath.l1.id: clusterpath l1 id

Description Usage Arguments Value Author(s) Examples

Description

Cluster a matrix using the identity weights on each dimension. The L1 problem is separable, so we can process each dimension separately on each core if the parallel package is available.

Usage

1

Arguments

x

Matrix of data.

LAPPLY

Function to use to combine the results of each dimension. Defaults to mclapply for parallel processing if the parallel package is available, otherwise the standard lapply.

Value

data frame of optimal solutions at the breakpoints. need unique() when there are multiple lines that join at the exact same time (only pathological cases).

Author(s)

Toby Dylan Hocking

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
x <- c(-3,-2,0,3,5)
df <- clusterpath.l1.id(x)
head(df)
mean(x)
plot(df)
## check agreement with cvx
if(cvxmod.available()){
  cres <- cvxcheck(df,seq(0,max(df$lambda),l=8),verbose=TRUE)
  orig <- data.frame(alpha=x,row=1:length(x),lambda=0)
  p <- ggplot(df,aes(lambda,alpha))+
    geom_line(aes(group=row))+
    geom_point(aes(y=alpha.1),data=cres,pch=21)+
    scale_y_continuous(breaks=x,minor=min(x):max(x))
  print(p)
}

clusterpath documentation built on June 30, 2020, 3:02 a.m.