2
$\begingroup$

I have a problem where I need to provide the misclassification error for both training- and test-set. I am working with logistic regression, so I have a binomial family for my models. I have two models, one is lasso and the other is ridge. I need to find the misclassification error for training and test for both my lasso and ridge models. I am trying to solve this problem in R. Does anyone have any ideas if there is a formula/function in which this works out?

Also, wouldn't the training error for my models just be 0? As I am training my model with this data, and then predicting it against the same data? Thanks.

$\endgroup$
1
$\begingroup$

I think you can use glmnet package, with options family='binomial' and adjusting ElasticNet coefficient alpha to balance between L1 and L2 regularisations. An example is here.

Also, wouldn't the training error for my models just be 0? As I am training my model with this data, and then predicting it against the same data? Thanks.

Not necessarily, and typically (not always of course) it's a sign of overfitting. Especially, if there is a gap between training and testing performances. But, you can expect to see slightly more optimistic results in training set. It depends on the generalisation performance of your classifier. The two regularisation techniques are indeed there to help that problem.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.