Skip to content

PMSPLayer

Source code

Bases: tf.keras.layers.Layer

PMSP sim 3 model RNN layer.

Unrolling the PMSPCell for a fixed number of time steps.

See Plaut, McClelland, Seidenberg and Patterson (1996), simulation 3.

Parameters:

Name Type Description Default
tau float

Time-averaging parameter, from 0 to 1.

required
h_units int

Number of units in the hidden layer.

required
p_units int

Number of units in the phonological layer.

required
c_units int

Number of units in the cleanup layer.

required
h_noise float

Gaussian noise parameter (in stddev) for hidden layer.

0.0
p_noise float

Gaussian noise parameter (in stddev) for phonological layer.

0.0
c_noise float

Gaussian noise parameter (in stddev) for cleanup layer.

0.0
connections List[str]

List of connections to use, each connection consists of two letters (from, to). Default is ["oh", "ph", "hp", "pp", "cp", "pc"].

None
zero_out_rates Dict[str, float]

Dictionary of zero-out rates for each connection. Default is {c: 0.0 for c in self.connections}. See PMSP for more details.

None
l2 float

L2 regularization parameter, apply to all trainable weights and biases.

0.0

build(input_shape)

Build the layers.

call(inputs, training=False, return_internals=False)

Forward pass, unrolling the RNN cell.

Parameters:

Name Type Description Default
inputs tf.Tensor

Input tensor with shape (batch_size, max_ticks, input_units).

required
training bool

Whether to run in training mode or not.

False
return_internals bool

Whether to return intermediate inputs to each connection.

False

Returns:

Name Type Description
outputs Dict[str, tf.Tensor]

Activations with shape (batch_size, max_ticks, units) in each layer. E.g.: {"phonology": ...}, if return_internals=True, also return intermediate inputs with shape (batch_size, max_ticks, units) in each connection. E.g., {"oh": last_o @ w_{oh}, ...}