You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: If the group indexing is not set from 1 to m (the number of groups), this can lead to different solutions. Two conditions are needed to avoid this:
The group indexes should not have gaps. For example, 46,47,49.
The group indexes should be ordered and start from 1.
Example:
reorder_group <- function(groups){
max_grp_id = length(unique(groups))
new_grp = rep(0,length(groups))
all_grp_indices = as.numeric(names(table(groups)))
for (i in 1:max_grp_id){
var_ids = which(groups == all_grp_indices[i])
new_grp[var_ids] = i
}
return(new_grp)
}
set.seed(1)
groups = sample(1:50,size=100,replace=TRUE)
data=sgs::gen_toy_data(p=100,n=50,grouped=FALSE)
grp_new = reorder_group(groups)
order_grp = order(grp_new,decreasing=FALSE)
sgl_model = dfr_sgl(X=data$X,y=data$y,groups=groups)
This causes an error:
Error in if (any(pen_var_org < 0) | any(pen_grp_org < 0)) { :
missing value where TRUE/FALSE needed
The error is due to the screening indices for the groups having gaps. Removing the gaps fixes this but unless condition 2 above is also met, the solutions will be slightly different:
This does not seem to be caused by the screening but it's likely the L2 norm at some point is relying on the indexing being set from 1. Needs further investigation.
Current solution: added a warning to the user to sort their groups if they are detected not to be. Future solution: to sort the group indexes and X accordingly before the fitting starts and then reverse the sorting before outputting the results. The first step is simple to implement but the latter step requires re-sorting many different outputs. Need to think of a simpler way to do this. Temporary user fix: A user can avoid this behaviour by processing the group indices to meet the condition and changing X accordingly, as is done in the example above (sgl_model_2). The indices returned for the various metrics (such as selected_var) are of the order they are inputted into the function.
The text was updated successfully, but these errors were encountered:
Issue: If the group indexing is not set from 1 to m (the number of groups), this can lead to different solutions. Two conditions are needed to avoid this:
Example:
This causes an error:
The error is due to the screening indices for the groups having gaps. Removing the gaps fixes this but unless condition 2 above is also met, the solutions will be slightly different:
This does not seem to be caused by the screening but it's likely the L2 norm at some point is relying on the indexing being set from 1. Needs further investigation.
Current solution: added a warning to the user to sort their groups if they are detected not to be.
Future solution: to sort the group indexes and X accordingly before the fitting starts and then reverse the sorting before outputting the results. The first step is simple to implement but the latter step requires re-sorting many different outputs. Need to think of a simpler way to do this.
Temporary user fix: A user can avoid this behaviour by processing the group indices to meet the condition and changing X accordingly, as is done in the example above (
sgl_model_2
). The indices returned for the various metrics (such asselected_var
) are of the order they are inputted into the function.The text was updated successfully, but these errors were encountered: