# How to choose the model hyperparameter after cross-validation when the model fit indices are really similar?

I cross-validated a model using the classification accuracy using leave-one-out-cross-validation (proportion of correctly classified cases). Below is a matrix of accuracies typical to what I see. The rows and columns represent different combinations of two hyper-parameters that are cross-validated. For lower rows and more right columns, the model becomes more flexible, whereas it is far less flexible in the upper left corner of the matrix.

The accuracies are quite similar. Therefore I am hesitant to simply choose the parameter combination that maximizes the fit (lower right). I am too concerned that I may go wrong in choosing one of the extreme categories, as their fit does not differ much from other options.

How should one choose the model hyper-parameters in this case?

      [,1]  [,2]  [,3]  [,4]  [,5]
[1,] 0.699 0.673 0.693 0.686 0.693
[2,] 0.706 0.699 0.686 0.686 0.719
[3,] 0.699 0.699 0.686 0.693 0.719
[4,] 0.686 0.699 0.686 0.693 0.732
[5,] 0.693 0.699 0.680 0.706 0.732
[6,] 0.693 0.673 0.693 0.706 0.732

• Can you please clarify how big is your sample? In general, repeated CV or repeated bootstrap are more common-place than LOOCV. – usεr11852 Mar 13 '18 at 21:29
• @usεr11852 It is about n=300. I wanted to use as much data for training as possible, but I am not sure actually whether this is ideal. – tomka Mar 13 '18 at 21:31
• Well, we all do. :) Anyway, see the answer here I think addresses your question quite closely. In short, probably do a 100x 5-fold CV or bootstrap and you are fine. Also you show accuracy (and OK 3% change is not small) but there are other classification measurements that might help you tease out the best model eg. the parameters at [4,5] might be quite better in terms of Cohen's $k$ than the parameters in [6,5]. – usεr11852 Mar 13 '18 at 21:39
• @usεr11852 Interesting; I will try the repeated 5-fold CV. However, I am really not sure about the type of fit measure either. There are tons of options. Another one would be AUC for example. It seems they all may suggest a different model is best. In terms of objective I need a model that predicts the underlying class probabilities closely. Classification itself is less crucial. Do you happen to know which fit measure is best for this objective? (This is actually a new question perhaps) – tomka Mar 13 '18 at 21:49
• This means you want a well-calibrated model. Yes, in that case one would use a proper scoring rule like Brier score. – usεr11852 Mar 14 '18 at 0:07

That's where Occam's razor comes in: "simpler theories are preferable to more complex ones."

Put into your context: within a similar performance range, the least flexible model is preferable. This makes your model overfit less and thus hopefully more general.

More concretely, this selection is performed using the one standard error rule. Choose the least flexible model within a one standard error range of performance compared to the best model.

The above assumes that you've chosen the performance metric which is adapted to your problem at hand. In addition, leave one out CV has drawbacks on its own but they do not appear to be part of your question.

• Good idea. I remember the one standard error rule from the glmnet package (LASSO). It seems useful here too. However I wonder if I can simply apply to it any fit statistic. For example, I could have also used AUC (area under the receiver operating curve) instead of classification accuracy. Would it apply then as well? – tomka Mar 13 '18 at 20:52
• I don't think that the metric would matter in this context, though I do not know that for sure. – g3o2 Mar 13 '18 at 21:08
• And your concerns about LOOCV? The problem I have is that the sample is not large n=300, so I wanted to use as much data for training as possible. – tomka Mar 13 '18 at 21:27
• You can still use 10 fold CV, which uses 270 out of 300 observations for training each run. Regarding the concerns about LOOCV, check this post. – g3o2 Mar 13 '18 at 22:32
• Hmm in that link you attach they divide by $\sqrt(K-1)$, but shouldn't this be $\sqrt(K)$? – tomka Mar 14 '18 at 9:53