FIX use category and stacklevel=2 for {loss,score}_func

I'm not sure how to test the stacklevel properly, but it gave
the right file and line number in a short example script.