[][src]Struct vikos::cost::MaxLikelihood

pub struct MaxLikelihood;

Maximizes the likelihood function L by defining C=-ln(L)

You can use this function if your truth is a probability (i.e., a value between 0 and 1). Maximizing the likelihood function is equivalent to minimizing the least square error, yet this cost function has shown itself to converge quicker for some problems.

#Examples

use vikos::{learn_history, Model, teacher, cost};
use vikos::model::Logistic;
use std::default::Default;

let history = [([2.7, 2.5], false),
               ([1.4, 2.3], false),
               ([3.3, 4.4], false),
               ([1.3, 1.8], false),
               ([3.0, 3.0], false),
               ([7.6, 2.7], true),
               ([5.3, 2.0], true),
               ([6.9, 1.7], true),
               ([8.6, -0.2], true),
               ([7.6, 3.5], true)];

let mut model = Logistic::default();
let teacher = teacher::GradientDescent { learning_rate: 0.3 };
let cost = cost::MaxLikelihood {};

learn_history(&teacher,
              &cost,
              &mut model,
              history.iter().cycle().take(20).cloned());

Trait Implementations

impl Cost<f64, f64> for MaxLikelihood
[src]

impl Cost<bool, f64> for MaxLikelihood
[src]

impl<V> Cost<usize, V> for MaxLikelihood where
    V: Vector
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]