0

In the official example, both metrics and loss function are hard coded. I am wondering if we can pass those in the config jsonnet, so I can reuse my model in different datasets with different metrics.

  • Some models have hard-coded metrics, others allow configurable metrics. In general, there's no reason why you can't make the metrics for any model configurable. – petew Oct 05 '20 at 18:38

1 Answers1

0

I knew I had seen that question before. Copy and paste from GitHub:

Metric is registrable, so you can easily add a parameter to you model of type List[Metric], and then specify metrics in Jsonnet. You'll have to make sure those metrics take exactly the same input.

For the loss, this is a little bit harder. You would create your own Registrable base class, and then implement the losses you want to use this way. You can use the Metric class as an example of how to do this. It would be a bit of typing work, but not difficult.

Dirk Groeneveld
  • 2,547
  • 2
  • 22
  • 23