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

Method set_params

src/nn.rs:56–73  ·  view source on GitHub ↗

Sets the parameters which connect the given layer `layer` with the next layer.

(&self, layer: usize, params: Matrix<f64>)

Source from the content-addressed store, hash-verified

54 /// Sets the parameters which connect the given layer `layer` with the next
55 /// layer.
56 pub fn set_params(&self, layer: usize, params: Matrix<f64>) -> NeuralNetwork {
57
58 let mut m = self.params.clone();
59
60 match m.get_mut(layer) {
61 None => { panic!("Layer does not exist."); }
62 Some(mx) => {
63 assert!(mx.rows() == params.rows() &&
64 mx.cols() == params.cols(), "Parameter configuration is incompatible.");
65 *mx = params;
66 }
67 }
68
69 NeuralNetwork {
70 layers: self.layers.clone(),
71 params: m
72 }
73 }
74
75 /// Returns the number of input units.
76 pub fn input_size(&self) -> usize {

Callers 7

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

Calls 1

get_mutMethod · 0.80

Tested by 7

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