%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% UNS %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clc; close all; clear all;
load trenovaci_dataset;  % načtení trénovacího datasetu 

vyber=[1:37];           % použité příznaky
ID=ID_m;
data=data(vyber,:);
net = patternnet(10);   % vytvoření vzoru NS

% Nastavení parametrů pro trénování NS
net.trainParam.epochs=1000;     %Maximum number of epochs to train
net.trainParam.goal=0;          %Performance goal
net.trainParam.lr=0.01;     	%Learning rate
net.trainParam.lr_inc=1.05; 	% Ratio to increase learning rate
net.trainParam.lr_dec=0.7;      %Ratio to decrease learning rate
net.trainParam.max_fail=6;      % Maximum validation failures
net.trainParam.max_perf_inc=1.04;% Maximum performance increase
net.trainParam.mc=0.9;          %Momentum constant
net.trainParam.min_grad=1e-5;	%Minimum performance gradient
net.trainParam.show=25;         %Epochs between displays (NaN for no displays)
net.trainParam.showCommandLine=false;	%Generate command-line output
net.trainParam.showWindow=true;	%Show training GUI
net.trainParam.time=inf;        % Maximum time to train in seconds



net = train(net, data, ID);         % natrénování NS

clearvars -except net   % odstranění všech položek z workspace kromě natrénované UNS

save UNS_XY             % Uložení UNS 
