Created
April 22, 2015 10:25
-
-
Save palcu/10bde8253f66a0d0d2a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ ] = pr1() | |
m = 50 | |
for punct=1:m | |
X(1, punct) = unifrnd(-1, 1) | |
X(2, punct) = unifrnd(-1, 1) | |
end | |
for punct=1:m | |
determinant = 2*X(1,punct) - X(2,punct) | |
clasa = (determinant < 0) | |
if (clasa) | |
T(punct) = -1 | |
else | |
T(punct) = 1 | |
end | |
end | |
neuralnet1 = newp([-1 1; -1 1], 1, 'hardlims', 'learnp'); | |
neuralnet1.trainParam.epochs = 1000; | |
neuralnet1.trainParam.showWindow = false; | |
neuralnet1 = train(neuralnet1, X, T); | |
plotpv(X, hardlim(T)); | |
plotpc(neuralnet1.IW{1, 1}, neuralnet1.b{1}); | |
Y1 = confusionmat(hardlim(T), hardlim(SIM(neuralnet1, X))) | |
neuralnet2 = newp([-1 1; -1 1], 1, 'hardlims', 'learnpn'); | |
neuralnet2.trainParam.epochs = 1000; | |
neuralnet2.trainParam.showWindow = false; | |
neuralnet2 = train(neuralnet2, X, T); | |
plotpv(X, hardlim(T)); | |
plotpc(neuralnet2.IW{1, 1}, neuralnet2.b{1}); | |
Y2 = confusionmat(hardlim(T), hardlim(SIM(neuralnet2, X))) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment