Skip to content

fistaTree implementation issue : hierarchy of a tree is not maintained #2

@srijata06

Description

@srijata06

I am interested in solving a regression problem with the model y = X1beta1 + X2beta2 +...+X10*beta10 where the betas have a hierarchy which is described as follows:

beta1 is the root of the tree, beta2 is the only child of beta1, beta3 is the only child of beta2 and so on till beta10 is the only child of beta9. So its basically a chain.

So, the regression coefficients have the hierarchy such that if the i-th component is 0 then all components post the i-th component will also be 0.

I am implementing fistaTree in the following way but the estimated regression coefficients are not following the above required hierarchy.

There are 10 groups: (1,2,.....10), (2,...,10),...,(10)

"tree" list:

eta_g = (1,1,1,1,1,1,1,1,1,1)
own_variables = (1,2,3,4,...,10)
N_own_variables = (1,1,1,1,1,1,1,1,1,1), and the groups matrix will be
g[i,i-1] = 1, i = 2,3,...,10 and g[i,j] = 0 for all other i,j

Then we use the function as follows:

################### Building the tree structure #########################

own_variables = as.vector(seq(1,dim(X)[2]),mode= 'integer')
N_own_variables = as.vector(rep(1,dim(X)[2]),mode= 'integer')
eta_g = as.vector(rep(1,dim(X)[2]),mode = 'double')
group_indicator1 = matrix(0,dim(X)[2],dim(X)[2])

for(i in 2:10){
group_indicator1[i,(i-1)] = 1
}

groups = matrix(as.logical(group_indicator1),ncol = dim(X)[2], byrow = F)
groups = as(groups,'CsparseMatrix')
groups
tree = list('eta_g'= eta_g,'groups' = groups,'own_variables' = own_variables,
'N_own_variables' = N_own_variables)

W0 = matrix(0,nrow = ncol(X), ncol = ncol(Y))

############## Implementing fistaTREE #################

result <- spams.fistaTree(Y=Y,X=X,W0=W0,tree=tree,return_optim_info=TRUE,numThreads = 1,verbose = FALSE,lambda1 = 1, it0 = 10, max_it = 200,L0 = 0.1, tol = 1e-5, intercept = TRUE,pos = FALSE,compute_gram = TRUE,loss = 'square',regul = 'tree-linf')

beta_hat = result[[1]]

############## End of code ################

The following is the result we got. The first column is result[[1]], i.e., the estimated beta from fistaTree and the second column is the true beta

         [,1]             [,2]

[1,] 1.422799287 1.329295
[2,] 1.711161252 1.800279
[3,] 2.163903334 2.117584
[4,] 2.823394036 2.801249
[5,] 0.023795605 0.000000
[6,] -0.031258967 0.000000
[7,] 0.000000000 0.000000
[8,] 0.000000000 0.000000
[9,] 0.000000000 0.000000
[10,] -0.006140538 0.000000

The 10th component is non-zero while the 9th component is zero which is a violation to the tree hierarchy in the true beta.

We also tried different options for the 'regul' parameter but we faced the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions