(&self, x: &Matrix<f64>, labels: &Matrix<f64>, p: OptParams<f64>)
| 117 | } |
| 118 | |
| 119 | pub fn optimize(&self, x: &Matrix<f64>, labels: &Matrix<f64>, p: OptParams<f64>) -> NeuralNetwork { |
| 120 | |
| 121 | let a = p.alpha.unwrap(); |
| 122 | let mut n = self.clone(); |
| 123 | |
| 124 | for _ in (0..p.iter.unwrap()) { |
| 125 | let v = n.derivatives(x, labels).iter().map(|x| x.mul_scalar(-a)).collect::<Vec<_>>(); |
| 126 | n.update_params(&v); |
| 127 | } |
| 128 | n |
| 129 | } |
| 130 | |
| 131 | fn feedforward(&self, x: &[f64]) -> (Vec<Vec<f64>>, Vec<Vec<f64>>) { |
| 132 |
no test coverage detected