smooth.losses¶
Module: smooth.losses¶
Inheritance diagram for regreg.smooth.losses:
A module for commonly used losses that are not in regreg.smooth.glm. Only current example is Huberized SVM.
huberized_svm¶
-
class
regreg.smooth.losses.huberized_svm(X, labels, smoothing_parameter, coef=1.0, offset=None, quadratic=None, initial=None)¶ Bases:
regreg.smooth.smooth_atom-
__init__(X, labels, smoothing_parameter, coef=1.0, offset=None, quadratic=None, initial=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
affine(linear_operator, offset, coef=1, diag=False, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
apply_offset(x)¶ If self.offset is not None, return x-self.offset, else return x.
-
property
conjugate¶
-
get_conjugate()¶
-
get_lipschitz()¶
-
get_offset()¶
-
get_quadratic()¶ Get the quadratic part of the composite.
-
latexify(var=None, idx='')¶
-
classmethod
linear(linear_operator, coef=1, diag=False, offset=None, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
property
lipschitz¶
-
nonsmooth_objective(x, check_feasibility=False)¶
-
objective(x, check_feasibility=False)¶
-
objective_template= '\\ell^{\\text{Huber SVM}}\\left(%(var)s\\right)'¶
-
objective_vars= {'coef': 'C', 'offset': '\\alpha+', 'shape': 'p', 'var': '\\beta'}¶
-
property
offset¶
-
proximal(quadratic)¶
-
proximal_optimum(quadratic)¶
-
proximal_step(quadratic, prox_control=None)¶ Compute the proximal optimization
- Parameters
prox_control: [None, dict]
If not None, then a dictionary of parameters for the prox procedure
-
property
quadratic¶ Quadratic part of the object, instance of regreg.identity_quadratic.identity_quadratic.
-
scale(obj, copy=False)¶
-
set_lipschitz(value)¶
-
set_offset(value)¶
-
set_quadratic(quadratic)¶ Set the quadratic part of the composite.
-
classmethod
shift(offset, coef=1, quadratic=None, **kws)¶ Keywords given in kws are passed to cls constructor along with other arguments
-
smooth_objective(beta, mode='both', check_feasibility=False)¶ - Parameters
beta : ndarray
The current parameter values.
mode : str
One of [‘func’, ‘grad’, ‘both’].
check_feasibility : bool
If True, return np.inf when point is not feasible, i.e. when beta is not in the domain.
- Returns
If mode is ‘func’ returns just the objective value
at beta, else if mode is ‘grad’ returns the gradient
else returns both.
-
smoothed(smoothing_quadratic)¶ Add quadratic smoothing term
-
solve(quadratic=None, return_optimum=False, **fit_args)¶
-