fn approx_derivate<T: Copy>(cost: &impl Cost<T>, prediction: f64, truth: T) -> f64 {
        let epsilon = 0.00001;
        let f_plus_epsilon = cost.cost(prediction + epsilon, truth);
        let f_minus_epsilon = cost.cost(prediction - epsilon, truth);
        println!(
            "f_x_plus_epsilon: {}, f_x_minus_epsilon:: {}",
            f_plus_epsilon, f_minus_epsilon
        );
        (f_plus_epsilon - f_minus_epsilon) / (2.0 * epsilon)
    }
// Approximates the derivation of the cost function
Approximates the derivation of the cost function
Approximates the derivation of the cost function
fn approx_derivate<T: Copy>(cost: &impl Cost<T>, prediction: f64, truth: T) -> f64 {
        let epsilon = 0.00001;
        let f_plus_epsilon = cost.cost(prediction + epsilon, truth);
        let f_minus_epsilon = cost.cost(prediction - epsilon, truth);
        println!(
            "f_x_plus_epsilon: {}, f_x_minus_epsilon:: {}",
            f_plus_epsilon, f_minus_epsilon
        );
        (f_plus_epsilon - f_minus_epsilon) / (2.0 * epsilon)
    }
fn approx_derivate < T : Copy > ( cost : & impl Cost < T > , prediction : f64 , truth : T ) -> f64 { let epsilon = 0.00001 ; let f_plus_epsilon = cost . cost ( prediction + epsilon , truth ) ; let f_minus_epsilon = cost . cost ( prediction - epsilon , truth ) ; println ! ( " " f_plus_epsilon f_minus_epsilon ) ; ( f_plus_epsilon - f_minus_epsilon ) / ( 2.0 * epsilon ) }
Approximates the derivation of the cost function
Approximates the derivation of the cost function
cost
&impl Cost<T>
prediction
f64
truth
T
cost
&impl Cost<T>
prediction
f64
truth
T