archetypes.torch.NAA#

class archetypes.torch.NAA(n_archetypes, shape, relations=None, degree_correction=False, membership='soft', loss='normal', device='cpu')#

N-Archetype analysis implemented in PyTorch.

Parameters:
k: tuple

The number of archetypes to use for each dimension.

s: tuple

The number of observations in each dimension.

device: str

The device to use for training the model. Defaults to “cpu”.

Attributes:
A

A coefficient matrices.

B

B coefficient matrices.

Z

The archetype matrix.

Methods

train([mode])

Sets the module in training mode.

property A#

A coefficient matrices.

Returns:
list of torch.Tensor
property B#

B coefficient matrices.

Returns:
list of torch.Tensor
property Z#

The archetype matrix.

Returns:
torch.Tensor
train(mode: bool = True) T#

Sets the module in training mode.

This has any effect only on certain modules. See documentations of particular modules for details of their behaviors in training/evaluation mode, if they are affected, e.g. Dropout, BatchNorm, etc.

Args:
mode (bool): whether to set training mode (True) or evaluation

mode (False). Default: True.

Returns:

Module: self