smash.Model.get_nn_parameters_weight#

Model.get_nn_parameters_weight()[source]#

Get the weight of the parameterization neural network.

Returns:
valuelist[numpy.ndarray]

A list of arrays representing the weights of trainable layers.

See also

Model.nn_parameters

The weight and bias of the parameterization neural network.

Model.set_nn_parameters_weight

Set the values of the weight in the parameterization neural network.

Examples

>>> from smash.factory import load_dataset
>>> setup, mesh = load_dataset("cance")

Set the hydrological module to 'gr4_mlp' (hybrid hydrological model with multilayer perceptron)

>>> setup["hydrological_module"] = "gr4_mlp"

Set the number of neurons in the hidden layer to 3 (the default value is 16, if not set)

>>> setup["hidden_neuron"] = 3
>>> model = smash.Model(setup, mesh)

By default, the weights of trainable layers are set to zero. Access to their values with the getter methods get_nn_parameters_weight

>>> model.get_nn_parameters_weight()
[array([[0., 0., 0., 0.],
        [0., 0., 0., 0.],
        [0., 0., 0., 0.]], dtype=float32), array([[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]], dtype=float32)]

The output contains a list of weight values for trainable layers.