ytm.guided.config.TMConfig#

class ytm.guided.config.TMConfig#

Bases: BaseTMConfig

Settings for the guided TM models. Also takes every parameter of BaseTMConfig.

See also

ytm.guided.backends.act_loss

Available activation and loss pairs.

lr: float = 1.0#

Learning rate of the clause weights: w += lr * grad. fit can override it per call.

lambda_: float = 1.0#

Feedback rate. A clause gets feedback with probability 1 - exp(-lambda_ * |grad|). fit can override it per call.

weight_init: Literal['random'] | float | str = 'random'#

Initial clause weight magnitude.

  • "random": uniform in [0, 1).

  • "random:N": uniform in [0, N), N a positive float.

  • A number >= 0 sets every weight to that magnitude.

act_loss: ActLoss#

Output activation and loss. Its activation must be "softmax", "sigmoid" or "identity". Default SoftmaxCE().

fb_signal: Literal['delta_l', 'grad'] = 'delta_l'#

Signal that decides clause feedback.

  • "delta_l": change in loss when the clause output flips.

  • "grad": gradient of the loss for the clause’s class, signed by the clause polarity.