Trait rusty_machine::learning::glm::Criterion [] [src]

pub trait Criterion {
    type Link: LinkFunc;
    fn model_variance(&self, mu: f64) -> f64;

    fn initialize_mu(&self, y: &[f64]) -> Vec<f64> { ... }
    fn compute_working_weight(&self, mu: &[f64]) -> Vec<f64> { ... }
    fn compute_y_bar(&self, y: &[f64], mu: &[f64]) -> Vec<f64> { ... }
    fn apply_link_func(&self, vec: Vector<f64>) -> Vector<f64> { ... }
    fn apply_link_inv(&self, vec: Vector<f64>) -> Vector<f64> { ... }
    fn link_grad(&self, mu: f64) -> f64 { ... }
}

The criterion for the Generalized Linear Model.

This trait specifies a Link function and requires a model variance to be specified. The model variance must be defined to specify the regression family. The other functions need not be specified but can be used to control optimization.

Associated Types

The link function of the GLM Criterion.

Required Methods

The variance of the regression family.

Provided Methods

Initializes the mean value.

By default the mean takes the training target values.

Computes the working weights that make up the diagonal of the W matrix used in the iterative reweighted least squares algorithm.

This is equal to:

1 / (Var(u) * g'(u) * g'(u))

Computes the adjustment to the fitted values used during fitting.

This is equal to:

g`(u) * (y - u)

Applies the link function to a vector.

Applies the inverse of the link function to a vector.

Computes the gradient of the link function.

Implementors