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

Method add_layer

src/nn.rs:43–52  ·  view source on GitHub ↗

Adds an layer to the neural network.

(&self, n: usize)

Source from the content-addressed store, hash-verified

41
42 /// Adds an layer to the neural network.
43 pub fn add_layer(&self, n: usize) -> NeuralNetwork {
44
45 NeuralNetwork {
46 layers: self.layers.append(&[n]),
47 params: match self.layers.last() {
48 Some(&m) => self.params.append(&[self.create_params(n, m, self.layers() == 1)]),
49 None => vec![]
50 }
51 }
52 }
53
54 /// Sets the parameters which connect the given layer `layer` with the next
55 /// layer.

Callers 10

test_nnFunction · 0.80
test_set_paramsFunction · 0.80
test_predict_two_layerFunction · 0.80
test_predict_three_layerFunction · 0.80
test_feedforwardFunction · 0.80
test_errorFunction · 0.80
test_update_paramsFunction · 0.80
test_paramsFunction · 0.80
mainFunction · 0.80
plot_nnFunction · 0.80

Calls 3

appendMethod · 0.80
create_paramsMethod · 0.80
layersMethod · 0.80

Tested by 8

test_nnFunction · 0.64
test_set_paramsFunction · 0.64
test_predict_two_layerFunction · 0.64
test_predict_three_layerFunction · 0.64
test_feedforwardFunction · 0.64
test_errorFunction · 0.64
test_update_paramsFunction · 0.64
test_paramsFunction · 0.64