lir.algorithms.logistic_regression module

class lir.algorithms.logistic_regression.FourParameterLogisticCalibrator[source]

Bases: Transformer

Calculate LR of a score, belonging to one of two distributions, using a logistic model.

Calculates a likelihood ratio of a score value, provided it is from one of two distributions. Depending on the training data, a 2-, 3- or 4-parameter logistic model is used.

apply(instances: InstanceData) LLRData[source]

Apply the fitted calibrator to new data.

Parameters:

instances (InstanceData) – Instances to calibrate.

Returns:

Calibrated log-likelihood-ratio data.

Return type:

LLRData

fit(instances: InstanceData) Self[source]

Fit the calibrator to data.

Parameters:

instances (InstanceData) – Training instances.

Returns:

Fitted calibrator.

Return type:

Self

class lir.algorithms.logistic_regression.LogitCalibrator(**kwargs: dict)[source]

Bases: Transformer

Calculate LR from a score, belonging to one of two distributions using logistic regression.

Calculates a likelihood ratio of a score value, provided it is from one of two distributions. Uses logistic regression for interpolation.

Infinite values in the input are ignored, except if they are misleading, which is an error.

Parameters:

**kwargs (dict) – Keyword arguments forwarded to sklearn.linear_model.LogisticRegression.

apply(instances: InstanceData) LLRData[source]

Calculate LLR data from the fitted model.

Parameters:

instances (InstanceData) – Instances to calibrate.

Returns:

Calibrated log-likelihood-ratio data.

Return type:

LLRData

fit(instances: InstanceData) Self[source]

Fit the model on the data.

Parameters:

instances (InstanceData) – Training instances.

Returns:

Fitted calibrator.

Return type:

Self