I did get error message when I ran the following code: ridge.preds = predict(ridge.fit, newx = testing.matrix, type = 'class') Tried many times, can not get it to work, then Dr. Costello helped me out with the following code, which solved the problem. ridge.preds = predict.glmnet(ridge.fit, newx = as(testing.matrix, "dgCMatrix"), type = 'response') The google ref is "https://stackoverflow.com/questions/8458233/r-glmnet-as-matrix-error-message", with a message like this" What solved the problem for me was forcing x to a dgCMatrix. I seriously don't understand why, but it works for me".

Created by junwang xu junwangdenver

code problem and solution page is loading…