osl_dynamics.inference.layers.PoissonLayer#

class osl_dynamics.inference.layers.PoissonLayer(n_states, n_channels, *, learn_log_rates, initial_log_rates=None, **kwargs)#

Bases: tensorflow.keras.layers.Layer

Poisson observation model with a rate for each channel and state.

Parameters:
n_statesint

Number of states.

n_channelsint

Number of channels.

learn_log_ratesbool

Should the log-rates be trainable?

initial_log_ratesnp.ndarray, optional

Initial log-rates. Shape must be (n_states, n_channels).

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.

log_likelihood(x)#

Log-likelihood of each state.

Parameters:
xtf.Tensor

Counts. Shape is (batch_size, sequence_length, n_channels).

Returns:
log_likelihoodtf.Tensor

Shape is (batch_size, sequence_length, n_states).

regularization()#

No regularization.

Returns:
regularizationtf.Tensor

Scalar.