hello may I ask how to perform backward feature selection from matlab
2 次查看(过去 30 天)
显示 更早的评论
my dataset is basically on the statistical features i.e mean, median etc from a vibration signal and I only got 4 observation that I made which are the fault diameter
Diameter = [0.007 0.014 0.021 0.028]
and my target variables for features selection are
Data = [0.033019 0.243439 0.059263 0.245666 1.139656 -0.20858 0.326542 4.639047 19.23064 7.440109 34.51501;0.032947 0.116438 0.013558 0.121009 0.69156 -0.01656 0.808631 5.714945 51.00824 3.672869 20.99024;0.031289 0.227709 0.051851 0.229847 1.137602 -0.00279 0.538198 4.949382 21.93974 7.346022 36.35857;0.007701 0.838364 0.702854 0.838396 4.785144 0.10306 0.396814 5.7075 6.808162 108.868 621.3644]
therefore what i want to do is to determine which features is the best for my observation which what statistical features gives the best indication
0 个评论
回答(1 个)
Swaraj
2023-6-26
编辑:Swaraj
2023-6-26
Hi Muhd,
I understand that you want to perform backard feature selection in MATLAB.
To perform the backward feature selection, you can make use of “sequentialfs” function.
Documentation: Sequential feature selection using custom criterion - MATLAB sequentialfs (mathworks.com)
You can go through the below example from the documentation.
rng("default") % For reproducibility
opts = statset("Display","iter");
tf = sequentialfs(@myfun,ingredients,heat, ...
"Direction","backward","Options",opts);
Helper function:
function criterion = myfun(XTrain,yTrain,XTest,yTest)
mdl = fitrlinear(XTrain,yTrain);
predictedYTest = predict(mdl,XTest);
e = yTest - predictedYTest;
criterion = e'*e;
end
Hope it Helps!!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!