10 fold cross validation

30 views (last 30 days)
uma
uma on 13 Apr 2022
Answered: uma on 16 Jun 2022
how to use 10 fold cross validation in Multilayer extreme learning machine

Accepted Answer

Demet
Demet on 19 Apr 2022
Edited: Demet on 19 Apr 2022
Hello,
I have never used Multilayer extreme learning machine but i found this. The code below was written assuming that the code in this link is correct and It would be helpful for you
data= dlmread('data\\inputs1.txt'); %inputs
groups=dlmread('data\\targets1.txt'); % target
Fold=10;
indices = crossvalind('Kfold',length(groups),Fold);
for i =1:Fold
testy = (indices == i);
trainy = (~testy);
TestInputData=data(testy,:)';
TrainInputData=data(trainy,:)';
TestOutputData=groups(testy,:)';
TrainOutputData=groups(trainy,:)';
number_neurons=[1000 100 100 100];% acchetecture of network
NL=4;
ELM_Type=1;
[training_Acuracy]=MLP_elm_train(TrainInputData,TrainOutputData,number_neurons,ELM_Type,NL);%training
training_Acuracy_f(fold)=training_Acuracy; %keep training acc for each fold
[testing_Accuracy,output]=MLP_elm_predict(TestInputData, TestOutputData,ELM_Type,NL);%testing
testing_Accuracy_f(Fold)=testing_Accuracy;% keep testing acc for each fold
end
  1 Comment
uma
uma on 15 Jun 2022
thank you so much.

Sign in to comment.

More Answers (1)

uma
uma on 16 Jun 2022
how we can specify the input and target data as i have a dataset namely segment attached here.

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!