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());
The outer derivative of the cost function with respect to the prediction.
Value of the cost function.
The outer derivative of the cost function with respect to the prediction.
Value of the cost function.
The outer derivative of the cost function with respect to the prediction.
Value of the cost function.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static