pyprobound.base.Binding

class Binding(name='')

Bases: Transform, ABC

Abstract base class for binding modes and binding cooperativity.

Each Binding component links a specification storing experiment-independent parameters with the matching experiment and its specific parameters.

__init__(name='')

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Methods

cache(fun)

Decorator for a function to cache its output.

check_length_consistency()

Checks that input lengths of Binding components are consistent.

components()

Iterator of child components.

expected_log_score()

Calculates the expected log score.

expected_sequence()

Uninformative prior of input, used for calculating expectations.

forward(seqs)

A transformation applied to a sequence tensor.

freeze()

Turns off gradient calculation for all parameters.

key()

The specification of a Binding component.

max_embedding_size()

The maximum number of bytes needed to encode a sequence.

optim_procedure([ancestry, current_order])

The sequential optimization procedure for all Binding components.

reload(checkpoint)

Loads the model from a checkpoint file.

reload_from_state_dict(state_dict)

Loads the model from a state dict.

save(checkpoint[, flank_lengths])

Saves the model to a file with "state_dict" and "metadata" fields.

score_windows(seqs)

Calculates the score of each window before summing over them.

unfreeze([parameter])

Turns on gradient calculation for the specified parameter.

Attributes

unfreezable

alias of Literal['all']

Non-Inherited Members

abstract key()

The specification of a Binding component.

All Binding components with the same specification will be optimized together in the sequential optimization procedure.

Return type:

tuple[Spec, ...]

abstract expected_sequence()

Uninformative prior of input, used for calculating expectations.

Return type:

Tensor

expected_log_score()

Calculates the expected log score.

Return type:

float

abstract score_windows(seqs)

Calculates the score of each window before summing over them.

Parameters:

seqs (Tensor) – A sequence tensor of shape \((\text{minibatch},\text{length})\) or \((\text{minibatch},\text{in_channels},\text{length})\).

Return type:

Tensor

Returns:

A tensor with the score of each window.