Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- load Ionosphere;
- X = Ionosphere(:,1:34);
- Y = Ionosphere(:,35);
- Acc_CV = zeros(10,1);
- indeksy = crossvalind('Kfold', Y, 10);
- col=2;
- a=1;
- for i = 2:70
- i
- for k = 1:10
- test_k = (indeksy == k);
- train_k =~test_k;
- X_test = X(test_k,:);
- Y_test = Y(test_k,:);
- X_train = X(train_k,:);
- Y_train = Y(train_k,:);
- % Uczenie i walidacja sieci:
- net = feedforwardnet(i);
- net.trainFcn = 'trainoss';
- net.trainParam.epochs=500;
- net.trainParam.showWindow=false;
- net = train(net, X_train', Y_train');
- Y_Out = round(sim(net, X_test'));
- % Wyznaczenie dokładności
- Acc_CV(k) = 1 - sum(abs(Y_Out - Y_test'))/length(Y_test);
- end
- Acc_Final= mean(Acc_CV)
- Acc_Final_Tab_Epochs(a,1) = i;
- Acc_Final_Tab_Epochs(a,2)= Acc_Final;
- a=a+1;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement