Consider the following sentence that introduces a symbol, $f$, used later in the text (not shown):
A classifier is a function $f$, which takes an image as input and produces a label as output.
Should there be a comma before $f$? That is, should it say:
A classifier is a function, $f$, which takes an image as input and produces a label as output.