Why are different features selected every time when I use sequentialfs?

I am using sequentialfs to get the best features that describe my model. Below is the piece of code where I define the criterion function and run the feature selection.
f = @(xtrain, ytrain, xtest, ytest) ((sum((predict(fitlm(xtrain,ytrain,'linear'),xtest) - ytest).^2))/22)^0.5;
fs_rmse = sequentialfs(f,combine_train_data,BBS,'keepin',keepin);
I get a different set of features for the same data every time. How do I know which answer is right? Also, is the above code correct for selecting features based on minimization of RMSE?

Answers (0)

Categories

Asked:

on 10 Nov 2017

Edited:

on 17 Nov 2017

Community Treasure Hunt

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

Start Hunting!