GradientTester
Class that compares the computed gradient with an empirical gradient based on finite differences. Essential for debugging dynamic programs.
Value members
Concrete methods
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.
- Value parameters:
- epsilon
Difference to try
- f
the function to test
- randFraction
what percentage of x's domain to try.
- skipZeros
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!)
- toString
toString function for converting elements of x's domain to a string.
- tolerance
How big a relative difference before we start complaining.
- x
point to test from
- Returns:
differences in each component