Test error ridge regression

I am trying to find the test error for a ridge regression but getting the error
Error in cbind2(1, newx) %% nbeta : not-yet-implemented method for <data.frame> %%

## Using the tuning parameter fit the model to all the training data

ridge_fit_tuning_par = glmnet(X,y, alpha=0, standardize=FALSE, lambda=6.28)

## Compute fitted values for training data:

yhat_test = predict(ridge_fit_tuning_par,test_set)
head(yhat_test)

## Compute test error
test_error = mean((test_set$dis - yhat_test)^2)
test_error

Any ideas what i am doing wrong please?

Many Thank

I found that using as matrix resolve the issue:

yhat_test=predict(ridge_fit, newx=as.matrix(X), s=lambda_ridge_min)
head(yhat_test)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.