Hi all,
I build a model which returns

y =net(x)
which is a binary tensor, and the correct target is a tensor t
I want to train my model using a cost function which is formed from the confusion matrix.
How can I make the cost function using the values from confusion matrix such as TP, FP, TN, FN?
My cost function could be (1-TPR)^2 + FPR^2, where TPR = TP/(FN + TP) and FPR = FP/(FP + TN).