pub fn init_random_weights(hidden_dimension: usize, range: f64) -> Weights {
    let mut rng = thread_rng();

    // The hidden weights is a 785 by hidden dimension matrix, the input vector
    // has a length of 784 but a bias node of 1.0 is inserted into the input features
    // meaning 785 weights are needed. Each row of the matrix corresponds to a value
    // in the feature and each column corresponds to neuron in the network.
    let iter = (0..785 * hidden_dimension).map(|_| rng.gen_range(-range, range));
    let hidden_weights = DMatrix::from_iterator(785, hidden_dimension, iter);
    let hidden_momentum = DMatrix::<f64>::zeros(785, hidden_dimension);

    // The output weights is a hidden dimension + 1 (for bias) by 10 matrix. Each row
    // is for a hidden neuron and each column is for and output value (0-9).
    let iter = (0..(hidden_dimension + 1) * 10).map(|_| rng.gen_range(-range, range));
    let output_weights = DMatrix::from_iterator(hidden_dimension + 1, 10, iter);
    let output_momentum = DMatrix::<f64>::zeros(hidden_dimension + 1, 10);

    Weights(
        hidden_weights,
        hidden_momentum,
        output_weights,
        output_momentum,
    )
}
/* Creates matrices with random values within +-range for weights and momentum matrices
 * with initial values of 0 */
Creates matrices with random values within +-range for weights and momentum matrices
with initial values of 0
Creates matrices with random values within + - range for weights and momentum matrices with initial values of 0
pub fn init_random_weights(hidden_dimension: usize, range: f64) -> Weights {
    let mut rng = thread_rng();
    // The hidden weights is a 785 by hidden dimension matrix, the input vector
    // has a length of 784 but a bias node of 1.0 is inserted into the input features
    // meaning 785 weights are needed. Each row of the matrix corresponds to a value
    // in the feature and each column corresponds to neuron in the network.
    let iter = (0..785 * hidden_dimension).map(|_| rng.gen_range(-range, range));
    let hidden_weights = DMatrix::from_iterator(785, hidden_dimension, iter);
    let hidden_momentum = DMatrix::<f64>::zeros(785, hidden_dimension);
    // The output weights is a hidden dimension + 1 (for bias) by 10 matrix. Each row
    // is for a hidden neuron and each column is for and output value (0-9).
    let iter = (0..(hidden_dimension + 1) * 10).map(|_| rng.gen_range(-range, range));
    let output_weights = DMatrix::from_iterator(hidden_dimension + 1, 10, iter);
    let output_momentum = DMatrix::<f64>::zeros(hidden_dimension + 1, 10);
    Weights(
        hidden_weights,
        hidden_momentum,
        output_weights,
        output_momentum,
    )
}
pub fn init_random_weights ( hidden_dimension : usize , range : f64 ) -> Weights { let mut rng = thread_rng ( ) ; // The hidden weights is a 785 by hidden dimension matrix, the input vector // has a length of 784 but a bias node of 1.0 is inserted into the input features // meaning 785 weights are needed. Each row of the matrix corresponds to a value // in the feature and each column corresponds to neuron in the network. let iter = ( 0 .. 785 * hidden_dimension ) . map ( | _ | rng . gen_range ( - range , range ) ) ; let hidden_weights = DMatrix :: from_iterator ( 785 , hidden_dimension , iter ) ; let hidden_momentum = DMatrix :: < f64 > :: zeros ( 785 , hidden_dimension ) ; // The output weights is a hidden dimension + 1 (for bias) by 10 matrix. Each row // is for a hidden neuron and each column is for and output value (0-9). let iter = ( 0 .. ( hidden_dimension + 1 ) * 10 ) . map ( | _ | rng . gen_range ( - range , range ) ) ; let output_weights = DMatrix :: from_iterator ( hidden_dimension + 1 , 10 , iter ) ; let output_momentum = DMatrix :: < f64 > :: zeros ( hidden_dimension + 1 , 10 ) ; Weights ( hidden_weights , hidden_momentum , output_weights , output_momentum , ) }
Creates matrices with random values within +-range for weights and momentum matrices
 with initial values of 0
Creates matrices with random values within + - range for weights and momentum matrices with initial values of 0
hidden_dimension
usize
range
f64
hidden_dimension
usize
range
f64