chemicalchecker.tool.targetmate.evaluation.validation.thOpt

class thOpt(tm, is_tmp, thresholds=None)[source]

Bases: object

Apply out-of-bag thresholding from ____

Methods

calculate

Optimize the decision threshold based on the prediction probabilities of the out-of-bag set of random forest.

calculate(labels_train, ThOpt_metrics='Kappa')[source]

Optimize the decision threshold based on the prediction probabilities of the out-of-bag set of random forest. The threshold that maximizes the Cohen’s kappa coefficient or a ROC-based criterion on the out-of-bag set is chosen as optimal.

Parameters

oob_probslist of floats

Positive prediction probabilities for the out-of-bag set of a trained random forest model

labels_train: list of int

True labels for the training set

thresholds: list of floats

List of decision thresholds to screen for classification

ThOpt_metrics: str

Optimization metric. Choose between “Kappa” and “ROC”

Returns

thresh: float

Optimal decision threshold for classification