-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmynn.m
42 lines (32 loc) · 976 Bytes
/
mynn.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
function [outputs] =mynn(X,yxx)
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by NPRTOOL
% Created Tue Dec 20 13:02:47 AST 2016
%
% This script assumes these variables are defined:
%
% X - input data.
% yxx - target data.
inputs = X';
targets = yxx';
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(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);
%view(net)
%Plots
% %Uncomment these lines to enable various plots.
% figure, plotperform(tr)
% figure, plottrainstate(tr)
% figure, plotconfusion(targets,outputs)
% figure, plotroc(targets,outputs)
% figure, ploterrhist(errors)