Skip to content

Models

tinytopics.models

NeuralPoissonNMF

Bases: Module

__init__(n, m, k, device=None)

Neural Poisson NMF model with sum-to-one constraints on document-topic and topic-term distributions.

Parameters:

Name Type Description Default
n int

Number of documents.

required
m int

Number of terms (vocabulary size).

required
k int

Number of topics.

required
device device | None

Device to run the model on. Defaults to CPU.

None

forward(doc_indices)

Forward pass of the neural Poisson NMF model.

Parameters:

Name Type Description Default
doc_indices Tensor

Indices of documents in the batch.

required

Returns:

Type Description
Tensor

Reconstructed document-term matrix for the batch.

get_normalized_F()

Get the learned, normalized topic-term distribution matrix (F).

Returns:

Type Description
Tensor

Normalized F matrix on the CPU.

get_normalized_L()

Get the learned, normalized document-topic distribution matrix (L).

Returns:

Type Description
Tensor

Normalized L matrix on the CPU.