Debugging

Setting Breakpoints

If the trainer reports JavaScript errors, you’ve probably got a bug in your ruleset code. If you can’t find it by examination and need to place a breakpoint, the tool of choice is the FathomFox Evaluator.

  1. Run fathom fox, and pass it your ruleset:

    fathom fox -r rulesets.js
    
  2. Use the instance of Firefox that comes up to open a page that you think will reproduce the problem.

  3. Show the dev tools, and navigate to the Debugger panel.

  4. In the disclosure tree to the left, disclose FathomFox, and select rulesets.js.

  5. Scroll to the bottom, past the minified mess, and you’ll see your ruleset code. Place a breakpoint as you like, probably in one of your scoring callbacks.

  6. Invoke the Evaluator from the Fathom toolbar menu.

  7. Click Evaluate to run the ruleset over the loaded tabs.

You’ll end up in the debugger, paused at your breakpoint.

Identifying Misrecognized Elements

Note

Make sure you have the latest trained coefficients and biases pasted into your ruleset before you do this, or recognition won’t work well.

FathomFox’s Evaluator can point out misrecognized elements, in case the tag exerpts emitted by the trainer are insufficient to identify them. To use the Evaluator:

  1. Open an instance of Firefox with FathomFox and your ruleset loaded (fathom-fox -r rulesets.js makes this simple).

  2. Open all of the samples you want to diagnose as separate tabs.

  3. Open the Evaluator page using FathomFox’s browser action button.

  4. In the Trainee dropdown, select the trainee you want to diagnose.

  5. Click the Evaluate button.

  6. Click any red box to navigate to a page with misrecognized nodes.

  7. On that tab, open the dev tools panel (ctrl-shift-N) and switch to the Fathom panel. Unfortunately, there aren’t yet web extension APIs to do this part automatically.

  8. At this point, you’ll see a quick and dirty representation of the “bad” element: a new label called “BAD [the trainee]”. Be sure to delete this if you choose to re-save the page for some reason. Also note that the BAD label is created only when the bad cell is clicked, for speed; if you navigate to the bad page manually, the label won’t be there, or there might be an old label from a previous iteration.

  9. Return to the Evaluator tab and click any other red boxes you want to explore.

Histograms

Finally, a great way to examine the scores your rules are emitting is fathom histogram. It can show you how useful a discriminator a rule is and help you notice when the distribution of output values is not what you expect.

_images/histogram1.png