# Reusing TPR and FPR values for different test sets

Say I train a binary classifier on $$n$$ balanced examples, then I evaluate the model on a test set which has the same (balanced) label distribution as the train set ($$P \approx N$$) and I compute $$TPR$$ (True Positive Rate), $$FPR$$ (False Positive Rate) and precision ($$p$$) at a particular threshold $$t$$.

The precision will be: $$p=\frac{TP}{TP+FP} = \frac{TPR\cdot P}{TPR\cdot P + FPR \cdot N} = \frac{TPR}{TPR + FPR\cdot\frac{N}{P}} \approx \frac{TPR}{TPR + FPR}$$

Now, I evaluate the same model on a different, imbalanced test set (e.g. $$N' = f \cdot P'$$).

Is it correct to say that the precision on this new test set will be: $$p'=\frac{TP'}{TP'+FP'} = \frac{TPR\cdot P'}{TPR \cdot P' + FPR \cdot N'} = \frac{TPR}{TPR + FPR\cdot\frac{N'}{P'}} =\frac{TPR}{TPR + FPR\cdot f}$$ that is, to reuse the $$TPR$$ and $$FPR$$ values from the previous evaluation?

Intuitively, a trained model learns to correctly classify a fraction of the positive examples (i.e. $$TPR$$) and incorrectly classifies a fraction the negative examples (i.e. $$FPR$$). That being said, one can approximate other metrics on different test sets (precision, in this case), solely by making use of these 2 values.

Is my understanding correct? What are some possible caveats to this?