Creates random parameters which connect one layer with the other layer. The parameter `rows` denotes the number of layers in the right layer. The parameter `cols` denotes the number of layers in the left layer. If `from_input_layer` is `true` the left layer is an input layer. Otherwise, the left layer is a hidden layer.
(&self, rows: usize, cols: usize, from_input_layer: bool)
| 33 | /// `from_input_layer` is `true` the left layer is an input layer. Otherwise, |
| 34 | /// the left layer is a hidden layer. |
| 35 | fn create_params(&self, rows: usize, cols: usize, from_input_layer: bool) -> Matrix<f64> { |
| 36 | |
| 37 | let n = if from_input_layer { cols } else { cols + 1 }; |
| 38 | |
| 39 | Matrix::from_vec(random::<f64>(rows * n), rows, n).unwrap() |
| 40 | } |
| 41 | |
| 42 | /// Adds an layer to the neural network. |
| 43 | pub fn add_layer(&self, n: usize) -> NeuralNetwork { |
no outgoing calls