ytm.guided.backends.buffers.GuidedFitBuffers#

class ytm.guided.backends.buffers.GuidedFitBuffers#

Bases: FitBuffers

Fit buffers of the guided TM. Adds to FitBuffers:

Attributes:
gradarray of shape (n_classes,)

Loss gradient w.r.t. the votes for the current sample.

y_hatarray of shape (n_classes,)

Activated votes for the current sample.

lossarray of shape (1,)

Loss for the current sample.

lr, lambda_float

Learning rate and feedback strength for this epoch: the fit call’s value, or the config’s.

votes_neg_ck, y_hat_neg_ckarray of shape (total_clauses, n_classes)

Votes and activations if each clause’s output were flipped. fb_signal="delta_l" only, else None.

loss_neg_ckarray of shape (total_clauses,)

Loss if each clause’s output were flipped. fb_signal="delta_l" only, else None.

end_epoch() → None#

Drop the epoch’s inputs and reset the chunk range.

load_chunk(start: int, end: int) → None#

Move samples [start, end) of every per-sample field to the device.

start_epoch(**fields: Any) → None#

Take the epoch’s inputs as keyword arguments, X included.

Per-sample fields are kept on the host until load_chunk. The others are set now, numpy arrays moved to the device.