Hello, first post, yay.

I’m doing some defect detection with my primary metric being pass/fail recall/precision. But they also want the cross pareto. The problem I’m running into is a balance problem for the model. I either have it balanced for multiclass or pass fail. I just want to see if my thought process makes sense or if there’s a better way.

```
import torch
counts = {"class1": 10, "class2": 10, "class3": 9, "Pass":10}
n = len(counts)
weights = [1]*(n-1) + [n-1] # assume pass is last
weights = torch.tensor(weights)
weights = weights/((n-1)*2)
weights
mc_criterion = torch.nn.CrossEntropyLoss()
binary_criterion = torch.nn.CrossEntropyLoss(weight=weights)
# then in the training loop, the loss is some weighted sum of the two
.2*mc_criterion(outputs, labels) + .8*binary_criterion(outputs, labels)
```

I’ve also started looking into hierarchical modeling where I run pass/fail first, and if it fails, go to a secondary model for defect classification.