-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathannClassifier.m
42 lines (35 loc) · 1.21 KB
/
annClassifier.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Face Recognition using Independent Component Analysis (ICA)
% Created on Mar 2015
% Authors: Sid Ali Rezetane, Sina M. Baharlou, Harold Agudelo
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by NFTOOL
% Created Fri Feb 27 17:42:35 CET 2015
%
% This script assumes these variables are defined:
%
% p - input data.
% t - target data.
function [n, p] = annClassifier(inputs, targets, hiddenLayerSize)
% Create a Fitting Network
net = fitnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70 / 100;
net.divideParam.valRatio = 15 / 100;
net.divideParam.testRatio = 15 / 100;
% Train the Network
[net, tr] = train(net, inputs, targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets, outputs);
performance = perform(net, targets, outputs);
p = performance;
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
% figure, plotperform(tr)
% figure, plottrainstate(tr)
% figure, plotfit(net,inputs,targets)
% figure, plotregression(targets,outputs)
% figure, ploterrhist(errors)
n = net;