(yTrue: Tensor, yPred: Tensor)
| 60 | } |
| 61 | |
| 62 | export function precision(yTrue: Tensor, yPred: Tensor): Tensor { |
| 63 | return tidy(() => { |
| 64 | const tp = truePositives(yTrue, yPred); |
| 65 | const fp = falsePositives(yTrue, yPred); |
| 66 | |
| 67 | const denominator = tfc.add(tp, fp); |
| 68 | |
| 69 | return tfc.cast( |
| 70 | tfc.where(tfc.greater(denominator, 0), tfc.div(tp, denominator), 0), |
| 71 | 'float32'); |
| 72 | }); |
| 73 | } |
| 74 | |
| 75 | export function recall(yTrue: Tensor, yPred: Tensor): Tensor { |
| 76 | return tidy(() => { |
nothing calls this directly
no test coverage detected
searching dependent graphs…