Trait rusty_machine::learning::nnet::Criterion
[−]
[src]
pub trait Criterion {
type ActFunc: ActivationFunc;
type Cost: CostFunc<Matrix<f64>>;
fn activate(&self, mat: Matrix<f64>) -> Matrix<f64> { ... }
fn grad_activ(&self, mat: Matrix<f64>) -> Matrix<f64> { ... }
fn cost(&self, outputs: &Matrix<f64>, targets: &Matrix<f64>) -> f64 { ... }
fn cost_grad(&self, outputs: &Matrix<f64>, targets: &Matrix<f64>) -> Matrix<f64> { ... }
}Criterion for Neural Networks
Specifies an activation function and a cost function.
Associated Types
type ActFunc: ActivationFunc
The activation function for the criterion.
type Cost: CostFunc<Matrix<f64>>
The cost function for the criterion.
Provided Methods
fn activate(&self, mat: Matrix<f64>) -> Matrix<f64>
The activation function applied to a matrix.
fn grad_activ(&self, mat: Matrix<f64>) -> Matrix<f64>
The gradient of the activation function applied to a matrix.
fn cost(&self, outputs: &Matrix<f64>, targets: &Matrix<f64>) -> f64
The cost function.
Returns a scalar cost.
fn cost_grad(&self, outputs: &Matrix<f64>, targets: &Matrix<f64>) -> Matrix<f64>
The gradient of the cost function.
Returns a matrix of cost gradients.
Implementors
impl Criterion for BCECriterionimpl Criterion for MSECriterion