kindred.LogisticRegressionWithThreshold¶
-
class
kindred.
LogisticRegressionWithThreshold
(threshold=0.5)[source]¶ A modified Logistic Regression classifier that will filter calls by a custom threshold, instead of the default 0.5. This allows for control of the precision-recall tradeoff, e.g. false positives versus false negatives.
Variables: - clf – The underlying LogisticRegression classifier
- threshold – Threshold to use, should be between 0 and 1
Methods
-
__init__
(threshold=0.5)[source]¶ Set up a Logistic Regression classifier that can use a different threshold for predictions and thereby be more lenient (lower threshold, false positives increase, false negatives decrease) or more conservative (higher threshold, false positives decrease, false negative increase).
Parameters: threshold (float) – Threshold to use, should be between 0 and 1
-
fit
(X, Y)[source]¶ Train the classifier using the associated matrix X and classes Y. Class zero should represent no associated class.
Parameters: - X (sparse matrix) – Training vector
- Y (matrix) – Associated class for each row of X