jacobbien / hierNet

A Lasso for Hierarchical Interactions
4 stars 3 forks source link

How to Apply hierNet to Categorical Variables #2

Closed jiachangliu closed 3 years ago

jiachangliu commented 3 years ago

Suppose all my variables in X are categorical. How do I use hierNet in R to build a sparse two-way interaction model?

I have tried converting all my variables into dummy variables (one-hot encoding). However, during some of my hierNet run in R, it gives me the following error:

Error in compute.interactions.c(x, diagonal = diagonal) : 
  NA/NaN/Inf in foreign function call (arg 1)

Is it the right approach to convert all variables into dummy variables? Why does the above error occur?

jiachangliu commented 3 years ago

For other people who may encounter this problem, I set both main effect and interaction column normalization to false, and now the code works.

hierNet.logistic(..., stand.main=FALSE, stand.int=FALSE, ...)