Huber
- class odl.functionals.default_functionals.Huber(*args, **kwargs)[source]
Bases:
FunctionalThe Huber functional.
Notes
The Huber norm is the integral over a smoothed norm. In detail, it is given by

where
denotes the Euclidean norm for vector-valued
functions which reduces to the absolute value for scalar-valued functions.
The function
with smoothing
is given by
- __init__(space, gamma)[source]
Initialize a new instance.
Parameters
- space
TensorSpace Domain of the functional.
- gammafloat
Smoothing parameter of the Huber functional. If
gamma = 0, the functional is non-smooth and corresponds to the usual L1 norm. Forgamma > 0, it has a1/gamma-Lipschitz gradient so that its convex conjugate isgamma-strongly convex.
Examples
Example of initializing the Huber functional:
>>> space = odl.uniform_discr(0, 1, 14) >>> gamma = 0.1 >>> huber_norm = odl.functionals.Huber(space, gamma=0.1)
Check that if all elements are >
gammawe get the L1-norm up to a constant:>>> x = 2 * gamma * space.one() >>> tol = 1e-5 >>> constant = gamma / 2 * space.one().inner(space.one()) >>> f = odl.functionals.L1Norm(space) - constant >>> abs(huber_norm(x) - f(x)) < tol True
Check that if all elements are <
gammawe get the squared L2-norm times the weight1/(2*gamma):>>> x = gamma / 2 * space.one() >>> f = 1 / (2 * gamma) * odl.functionals.L2NormSquared(space) >>> abs(huber_norm(x) - f(x)) < tol True
Compare Huber- and L1-norm for vanishing smoothing
gamma=0:>>> x = odl.core.phantom.white_noise(space) >>> huber_norm = odl.functionals.Huber(space, gamma=0) >>> l1_norm = odl.functionals.L1Norm(space) >>> abs(huber_norm(x) - l1_norm(x)) < tol True
Redo previous example for a product space in two dimensions:
>>> domain = odl.uniform_discr([0, 0], [1, 1], [5, 5]) >>> space = odl.ProductSpace(domain, 2) >>> x = odl.core.phantom.white_noise(space) >>> huber_norm = odl.functionals.Huber(space, gamma=0) >>> l1_norm = odl.functionals.GroupL1Norm(space, 2) >>> abs(huber_norm(x) - l1_norm(x)) < tol True
- space