Tests a gradient by comparing the gradient to the empirically calculated gradient from finite differences, returning those that are bad, logging bad ones on WARN, ok ones on DEBUG, and overall statistics on INFO.
Tests a gradient by comparing the gradient to the empirically calculated gradient from finite differences, returning those that are bad, logging bad ones on WARN, ok ones on DEBUG, and overall statistics on INFO.
the function to test
point to test from
what percentage of x's domain to try.
should we skip components of x where the calculated gradient is 0. (Sometimes useful with sparse features. You might want to check that 0's are always 0's though!)
Difference to try
How big a relative difference before we start complaining.
toString function for converting elements of x's domain to a string.
differences in each component
Class that compares the computed gradient with an empirical gradient based on finite differences. Essential for debugging dynamic programs.