Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %dane uczące
- X = load('nauka.txt');
- Y = X(:, end);
- X(:, end) = [];
- net = newff([0 1;0 1;0 1;0 1;0 1;0 1;0 1],[7 1],{'logsig' 'purelin'}, 'trainlm');
- %init - losujemy wagi początkowe
- net = init(net);
- net.trainParam.epochs = 200; %maksymalna liczba epok
- net.trainParam.goal = 1e-8;
- net = train(net, X', Y');
- %dane testowe
- X1 = load('testy.txt');
- Y1 = X1(:, end);
- X1(:, end) = [];
- Z = X1;
- Z = sim(net, X1');
- %Z = X;
- %Z = sim(net, X');
- Z1 = Z';
- %zliczenie ile wyników zaklasyfikował poprawnie
- licz1 = 0;
- licz2 = 0;
- F = Z1-Y1;
- for i=1:size(F)
- if abs(F(i)) > 0.5
- licz2 = licz2+1;
- else
- licz1 = licz1+1;
- end
- end
- licz1
- licz2
- licz1/(licz1+licz2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement