chemicalchecker.tool.targetmate.nonconformist.nc.RegressionErrFunc

class RegressionErrFunc[source]

Bases: object

Base class for regression model error functions.

Methods

apply

Apply the nonconformity function.

apply_inverse

Apply the inverse of the nonconformity function (i.e., calculate prediction interval).

abstract apply(prediction, y)[source]

Apply the nonconformity function.

Parameters

predictionnumpy array of shape [n_samples, n_classes]

Class probability estimates for each sample.

ynumpy array of shape [n_samples]

True output labels of each sample.

Returns

ncnumpy array of shape [n_samples]

Nonconformity scores of the samples.

abstract apply_inverse(nc, significance)[source]

Apply the inverse of the nonconformity function (i.e., calculate prediction interval).

Parameters

ncnumpy array of shape [n_calibration_samples]

Nonconformity scores obtained for conformal predictor.

significancefloat

Significance level (0, 1).

Returns

intervalnumpy array of shape [n_samples, 2]

Minimum and maximum interval boundaries for each prediction.