-
Notifications
You must be signed in to change notification settings - Fork 0
/
derivativeCheck_test.m
42 lines (32 loc) · 1.38 KB
/
derivativeCheck_test.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
fprintf('Testing gradient using forward-differencing...\n');
order = 1;
derivativeCheck(@func_to_min,mixed,order,1,net,size(content));
fprintf('Testing gradient using central-differencing...\n');
derivativeCheck(@func_to_min,mixed,order,2,net,size(content));
fprintf('Testing gradient using complex-step derivative...\n');
derivativeCheck(@func_to_min,mixed,order,3,net,size(content));
fprintf('\n\n\n');
pause
fprintf('Testing Hessian using forward-differencing\n');
order = 2;
derivativeCheck(@func_to_min,mixed,order,1,net,size(content));
fprintf('Testing Hessian using central-differencing\n');
order = 2;
derivativeCheck(@func_to_min,mixed,order,3,net,size(content));
fprintf('Testing Hessian using complex-step derivative\n');
order = 2;
derivativeCheck(@func_to_min,mixed,order,3,net,size(content));
fprintf('\n\n\n');
pause
fprintf('Testing gradient using fastDerivativeCheck...\n');
order = 1;
fastDerivativeCheck(@func_to_min,mixed,order,1,net,size(content));
fastDerivativeCheck(@func_to_min,mixed,order,2,net,size(content));
fastDerivativeCheck(@func_to_min,mixed,order,3,net,size(content));
fprintf('\n\n\n');
pause
fprintf('Testing Hessian using fastDerivativeCheck...\n');
order = 2;
fastDerivativeCheck(@func_to_min,mixed,order,1,net,size(content));
fastDerivativeCheck(@func_to_min,mixed,order,2,net,size(content));
fastDerivativeCheck(@func_to_min,mixed,order,3,net,size(content));