Struct rusty_machine::learning::nnet::BCECriterion [] [src]

pub struct BCECriterion {
    // some fields omitted
}

The binary cross entropy criterion.

Uses the Sigmoid activation function and the cross entropy error.

Methods

impl BCECriterion
[src]

fn new(regularization: Regularization<f64>) -> Self

Constructs a new BCECriterion with the given regularization.

Examples

use rusty_machine::learning::nnet::BCECriterion;
use rusty_machine::learning::toolkit::regularization::Regularization;

// Create a new BCE criterion with L2 regularization of 0.3.
let criterion = BCECriterion::new(Regularization::L2(0.3f64));

Trait Implementations

impl Debug for BCECriterion
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for BCECriterion
[src]

impl Clone for BCECriterion
[src]

fn clone(&self) -> BCECriterion

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Criterion for BCECriterion
[src]

type ActFunc = Sigmoid

The activation function for the criterion.

type Cost = CrossEntropyError

The cost function for the criterion.

fn regularization(&self) -> Regularization<f64>

Returns the regularization for this criterion. Read more

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. Read more

fn cost_grad(&self, outputs: &Matrix<f64>, targets: &Matrix<f64>) -> Matrix<f64>

The gradient of the cost function. Read more

fn is_regularized(&self) -> bool

Checks if the current criterion includes regularization. Read more

fn reg_cost(&self, reg_weights: MatrixSlice<f64>) -> f64

Returns the regularization cost for the criterion. Read more

fn reg_cost_grad(&self, reg_weights: MatrixSlice<f64>) -> Matrix<f64>

Returns the regularization gradient for the criterion. Read more

impl Default for BCECriterion
[src]

Creates an MSE Criterion without any regularization.

fn default() -> Self

Returns the "default value" for a type. Read more