MCPcopy Create free account
hub / github.com/daniel-e/rustml / create_params

Method create_params

src/nn.rs:35–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 2

add_layerMethod · 0.80
test_nn_create_paramsFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_nn_create_paramsFunction · 0.64