Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quastion about derivative - part 2 #22

Open
sdahan12 opened this issue Nov 27, 2016 · 0 comments
Open

quastion about derivative - part 2 #22

sdahan12 opened this issue Nov 27, 2016 · 0 comments

Comments

@sdahan12
Copy link

hi,
in part 2 there is a calculation of dzdx_empirical ,
can somone help and explain the calculation? why is there a sum? and why is there a division by eta and not a division by etx*ex (as i expected to be)?

thanks!

% Check the derivative numerically
ex = randn(size(x), 'single') ;
eta = 0.0001 ;
xp = x + eta * ex ;
yp = vl_nnconv(xp, w, []) ;

dzdx_empirical = sum(dzdy(:) .* (yp(:) - y(:)) / eta) ;
dzdx_computed = sum(dzdx(:) .* ex(:)) ;

fprintf(...
'der: empirical: %f, computed: %f, error: %.2f %%\n', ...
dzdx_empirical, dzdx_computed, ...
abs(1 - dzdx_empirical/dzdx_computed)*100) ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant