I know that you can prevent overtraining automatically in a network if you use NetTrain with NetChain in Mathematica version 12, but is there a way to prevent overtraining when using the Predict function to train a network? Or is overfitting prevention already built into the function itself? I can't seem to find any leads in the documentation page. Any help would be greatly appreciated!

  • 3
    $\begingroup$ There are some bits in the docs for Predict about L2Regularization and the ValidationSet option. It doesn't explicitly mention overfitting, but I think it does attempt to prevent it using regularization. Divide your data into something like 70-30 training to validation and try it out. $\endgroup$
    – flinty
    Commented Sep 26, 2021 at 21:12

1 Answer 1


Props to @flinty for this answer.

I played around with the Predict function with the ValidationSet option, and used 1500 data points for training with 500 for validation.

Displaying the L2Regularization value afterwards yielded a value of 0. Thus meaning that overfitting prevention should already be included in the Predict function, and it automatically prevents overfitting all by itself.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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