Creating a bcml_model
instance
To create a new bcml_model
instance, all you need to pass is a model
, a machine learning binary classification model. This library was designed to work with scikit-learn
classifiers, such as sklearn.linear_model.LogisticRegression
, sklearn.ensemble.RandomForestClassifier
, or sklearn.ensemble.GradientBoostingClassifier
.
The formula used by req_sig_cs
arises as follows.
We know that $$\mathcal{S} = \frac{S \cdot \text{TPR}}{\sqrt{S \cdot \text{TPR} + B \cdot \text{FPR}}} = \frac{\mathcal{L} \cdot \sigma_s \cdot \text{TPR}}{\sqrt{\mathcal{L} \cdot \sigma_s \cdot \text{TPR} + \mathcal{L} \cdot \sigma_s \cdot \text{FPR}}}$$ We can work toward solving for $\sigma_s$ as follows. \begin{align} \mathcal{S} &= \frac{\mathcal{L} \cdot \sigma_s \cdot \text{TPR}}{\sqrt{\mathcal{L} \cdot \sigma_s \cdot \text{TPR} + \mathcal{L} \cdot \sigma_b \cdot \text{FPR}}} \\ \mathcal{S} \left(\sqrt{\mathcal{L} \cdot \sigma_s \cdot \text{TPR} + \mathcal{L} \cdot \sigma_b \cdot \text{FPR}}\right)&= \mathcal{L} \cdot \sigma_s \cdot \text{TPR} \\ \mathcal{S}^2 \left(\sigma_s \cdot \text{TPR} + \sigma_b \cdot \text{FPR}\right) &= \mathcal{L} \cdot \sigma_s^2 \cdot \text{TPR}^2 \\ 0 &= -\left(\mathcal{L} \cdot \text{TPR}^2\right)\sigma_s^2 + \left(\mathcal{S}^2 \cdot \text{TPR}\right)\sigma_s + \left(\mathcal{S}^2 \cdot \sigma_b \cdot \text{FPR}\right) \end{align} This is then easily solvable using the quadratic formula.