Regularization

Trait Regularization 

Source
pub trait Regularization:
    Debug
    + Send
    + Sync {
    // Required methods
    fn penalty(&self, coefficients: &Array1<Float>) -> Result<Float>;
    fn penalty_gradient(
        &self,
        coefficients: &Array1<Float>,
    ) -> Result<Array1<Float>>;
    fn strength(&self) -> Float;
    fn name(&self) -> &'static str;

    // Provided methods
    fn proximal_operator(
        &self,
        coefficients: &Array1<Float>,
        _step_size: Float,
    ) -> Result<Array1<Float>> { ... }
    fn is_non_smooth(&self) -> bool { ... }
}
Expand description

Trait for regularization penalties

Required Methods§

Source

fn penalty(&self, coefficients: &Array1<Float>) -> Result<Float>

Compute the regularization penalty value

Source

fn penalty_gradient( &self, coefficients: &Array1<Float>, ) -> Result<Array1<Float>>

Compute the regularization gradient (subgradient for non-smooth penalties)

Source

fn strength(&self) -> Float

Get the regularization strength

Source

fn name(&self) -> &'static str

Get the name of this regularization

Provided Methods§

Source

fn proximal_operator( &self, coefficients: &Array1<Float>, _step_size: Float, ) -> Result<Array1<Float>>

Apply the proximal operator (for proximal gradient methods)

Source

fn is_non_smooth(&self) -> bool

Check if this regularization is non-smooth (requires proximal methods)

Implementors§