how to get good accuracy in mlp & k-fold crossvalidation code
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hello, can anyone help me...
I found a problem in k fold cross validation, my research uses 4 classes of right hand, left hand and right, left foot movements.
I need the mlp & k fold cross validation code with good accuracy
please help me, email: 16101109@ittelkom-pwt.ac.id
for df = 1:10
n = 1;
for c = 1:6520
if indices (1,c) == df
K_fold_test(n) = c;
n = n +1;
end
end
n = 1;
for c = 1:6520
if indices (1,c) ~= df
K_fold_train(n) = c;
n = n +1;
end
end
%test = (indices == df);
%train = ~test;
%train = train.';
U_testing = T_data_time(1:19,K_fold_test); %data testing MLP K_fold
%test = test.';
U_training = T_data_time(1:19,K_fold_train); % data training MLP K_fold
Target_test_MLP = Target_new(1:4,K_fold_test);
Target_train_MLP = Target_new(1:4,K_fold_train);
% h =[16];
h = [8 2]; %Jumlah node pada hidden layer
% h = [16 2];
%X = (T_var_time_nn_stdz).'; %pilih salah satu feature
% Data_train_MLP = (U).';
% Data_test_MLP = (UT).';
% Data_target_test = (Target_test_MLP).';
% Data_target_train = (Target_train_MLP).';
lambda = 1e-2;
[model, mse] = mlp(U_training, Target_train_MLP, h, lambda);
% plot(mse);
% disp(['T = [' num2str(Data_target_test) ']']);
Y_norm = mlpPred(model, U_testing);
% disp(['Y = [' num2str(Y) ']']);
Y_Max = max(Y_norm);
Y_output = zeros(size(Y_norm));
match = (Y_norm == Y_Max );
Y_output(match) = 1;
Y_output(~match)= 0;
Y_Round = round(Y_norm);
Y_R_all = [ Y_R_all Y_Round ] ;
plotconfusion(Target_test_MLP, Y_output)
figure
%Y_Round = round(Y);
%Y_R_all = [ Y_R_all Y_Round ] ;
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!