K-Fold Cross Validation
2 次查看(过去 30 天)
显示 更早的评论
Hi Guys,
I have data of 36 users
as shown in the code (MATLAB) data is loaded into a matrix called Feat_Vec1
clear;
for nc = 1 : 36 % nc number of users
% Load data into MATLAB
data{nc} = load( sprintf('U%02d_Acc_TimeD_FreqD_FDay.mat', nc) );
% assign data into Matrix
Feat_Vec1{nc} = data{nc}.Acc_TD_Feat_Vec(:,:);
end
for each user, I have 36 rows and 143 columns as a result, Feat_Vec1 contains 36 cells (number of users) and each cell contains 36 rows and 143 columns
I'd like to use 9-Fold Cross Validation in order to divide my dataset into training and testing.
First of all, 9-fold cross-validation means to user 8/9-th data for training and 1/9-th for testing. Repeat this nine times
I have seen this the documentation in MATLAB help but don't understand it!
I'm wondering if someone could help me please with the coding of 9-Fold Cross Validation for each user?
for examples:
for user1, 4 values from each column will be stored for testing and 32 values of each column will be used to train his model. This procedure will be repeated 9 times
Really appreciate any help
Regards.
2 个评论
John Chilleri
2017-1-26
Hello,
What metric are you using?
K-Fold cross validation is pretty easy to code yourself, but what model are you fitting to the data (linear/quadratic/etc.)? And how would you like the testing set to be tested, perhaps the standard MSE?
Swaroop Mishra
2017-1-31
Additionally, to reduce the coding effort, you can use Classification Learner App which is a part of Statistics and Machine Learning Toolbox.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!