Is it possible to use cross-validation in the training procedure of nonlinear regression to prevent overfitting?

6 views (last 30 days)
Hi Everyone,
I would like to ask if cross-validation can be used training procedure in a nonlinear regression model. I have read many questions and answers about it but I haven't found a solution yet. I have a data set that includes 8 predictors and 1 response variable. I divided it for training (%70 of all data) and testing (%30 of all data). I used nlinfit and nlpredicci as shown below. "modelfun" is a polynomial function. "ypred" is the forecasted value.
[beta,R,J,CovB,MSE] = nlinfit(Xtrain,Ytrain,@modelfun,b0,opts)
Xnew = Xtest; % new x values to be tested in the trained model are assigned to Xnew.
[ypred,~] = nlpredci(@modelfun,Xnew,beta,R,'Jacobian',J,'Covar',CovB,'MSE',MSE)
Now, this model gives the coefficients matrix(beta) using only one training set. I know that usage of crossval function which is testing your model using different sets of data (using k fold) and gives a mean error rate. Is that the only thing we can do using crossval ? While the training process is being carried out using k fold data sets, can I obtain the optimum coefficient matrix to be used for the prediction process as a result of these? I want to train my model with different data sets and determine the best coefficient matrix to be used in forecasting to prevent overfitting using cross-validation procedures but I am stuck at this point. Any suggestions?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!