copt.loss.LogLoss

class copt.loss.LogLoss(A, b, alpha=0.0)

Logistic loss function.

The logistic loss function is defined as

\[-\frac{1}{n}\sum_{i=1}^n b_i \log(\sigma(\bs{a}_i^T \bs{x})) + (1 - b_i) \log(1 - \sigma(\bs{a}_i^T \bs{x}))\]

where \(\sigma\) is the sigmoid function \(\sigma(t) = 1/(1 + e^{-t})\).

The input vector b verifies \(0 \leq b_i \leq 1\). When it comes from class labels, it should have the values 0 or 1.

References

http://fa.bianp.net/blog/2019/evaluate_logistic/

__init__(A, b, alpha=0.0)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(A, b[, alpha])

Initialize self.

expit_b(x, b)

Compute sigmoid(x) - b.

f_grad(x[, return_gradient])

hessian_mv(x)

Return a callable that returns matrix-vector products with the Hessian.

hessian_trace(x)

Return a callable that returns matrix-vector products with the Hessian.

logsig(x)

Compute log(1 / (1 + exp(-t))) component-wise.

Attributes

lipschitz

max_lipschitz

partial_deriv

expit_b(x, b)

Compute sigmoid(x) - b.

hessian_mv(x)

Return a callable that returns matrix-vector products with the Hessian.

hessian_trace(x)

Return a callable that returns matrix-vector products with the Hessian.

logsig(x)

Compute log(1 / (1 + exp(-t))) component-wise.