osl_dynamics.inference.layers.ConcentrationLayer#
- class osl_dynamics.inference.layers.ConcentrationLayer(n_distributions, n_categories, *, learn, initial_value=None, epsilon=1e-09, **kwargs)#
Bases:
ParameterLayerPositive concentrations of Dirichlet distributions.
The value is
softplus(kernel) + epsilon.- Parameters:
- n_distributionsint
Number of distributions.
- n_categoriesint
Number of categories.
- learnbool
Should the concentrations be trainable?
- initial_valuenp.ndarray, optional
Initial value. Shape must be (n_distributions, n_categories) and all values must be greater than epsilon.
- epsilonfloat, optional
Value added after the softplus.
- transform(kernel)#
Calculate the value of the parameter from the kernel.
- Parameters:
- kerneltf.Tensor
Trainable tensor of the layer.
- Returns:
- valuetf.Tensor
Value of the parameter.
- inverse_transform(value)#
Calculate the kernel from the value of the parameter.
- Parameters:
- valuenp.ndarray
Value of the parameter.
- Returns:
- kernelnp.ndarray
Kernel that gives the value.
- value()#
Value of the parameter.
- Returns:
- valuetf.Tensor
Transform of the kernel.
- assign(value, update_initializer=True)#
Set the value of the parameter.
- Parameters:
- valuenp.ndarray
Value of the parameter.
- update_initializerbool, optional
Should
resetset the parameter to this value?
- reset()#
Set the kernel to its initial value or a new random value.
- regularization()#
Regularization of the parameter.
- Returns:
- regularizationtf.Tensor
Scalar.
- summary_rows()#
Rows for the layer in the summary of a model.
- Returns:
- rowslist of tuple
(name, details, learned by, number of learned values)for each row.