tnmf.backends._Backend
¶
A module that defines a common interface for all backends.
Module Contents¶
Attributes¶
-
tnmf.backends._Backend.
sliceNone
¶
-
class
tnmf.backends._Backend.
Backend
(reconstruction_mode: str = 'valid')¶ Bases:
abc.ABC
The base class for all backends.
It exists to define a generic functional interface that is shared by all backends through inheritance, which allows a clear separation between algorithmic steps and their actual numerical implementation.
Some common functionality between all backends is already defined inside this class but can be overridden if necessary.
-
initialize
(self, V: numpy.ndarray, atom_shape: Tuple[int, Ellipsis], n_atoms: int, W: Optional[numpy.ndarray] = None, axes_W_normalization: Optional[Union[int, Tuple[int, Ellipsis]]] = None) → Tuple[numpy.ndarray, numpy.ndarray]¶
-
abstract static
to_ndarray
(arr) → numpy.ndarray¶
-
static
normalize
(arr: numpy.ndarray, axis: Optional[Union[int, Tuple[int, Ellipsis]]] = None)¶
-
abstract static
convolve_multi_1d
(arr: numpy.ndarray, kernels: Tuple[numpy.ndarray, Ellipsis], axes: Tuple[int, Ellipsis]) → numpy.ndarray¶
-
abstract
reconstruction_gradient_W
(self, V: numpy.ndarray, W: numpy.ndarray, H: numpy.ndarray, s: slice = sliceNone) → Tuple[numpy.ndarray, numpy.ndarray]¶
-
abstract
reconstruction_gradient_H
(self, V: numpy.ndarray, W: numpy.ndarray, H: numpy.ndarray, s: slice = sliceNone) → Tuple[numpy.ndarray, numpy.ndarray]¶
-
abstract
reconstruct
(self, W: numpy.ndarray, H: numpy.ndarray) → numpy.ndarray¶
-
partial_reconstruct
(self, W: numpy.ndarray, H: numpy.ndarray, i_atom: int) → numpy.ndarray¶
-
reconstruction_energy
(self, V: numpy.ndarray, W: numpy.ndarray, H: numpy.ndarray) → float¶
-