scxpand.autoencoders.ae_model_output#

Classes

DecoderOutput(mu[, pi, theta])

Container for autoencoder decoder outputs.

ModelOutput(latent_vec, mu, class_logit[, ...])

Container for autoencoder model outputs.

class scxpand.autoencoders.ae_model_output.DecoderOutput(mu, pi=None, theta=None)#

Container for autoencoder decoder outputs.

This class standardizes the decoder outputs, making the interface cleaner and more explicit about which outputs are available.

The decoder handles all transformations internally and returns processed values.

Variables:
  • mu – Mean parameter after inverse transforms to match row-normalized target scale [batch_size, n_genes]

  • pi – Dropout probability [batch_size, n_genes] (optional, only for ZINB)

  • theta – Dispersion parameter [batch_size, n_genes] (optional, only for NB/ZINB, positive values)

__init__(mu, pi=None, theta=None)#
detach()#

Detach all tensors from the computation graph.

Return type:

DecoderOutput

to(device)#

Move all tensors to the specified device.

Return type:

DecoderOutput

property device: device#

Get the device of the tensors.

mu: Tensor#
pi: Tensor | None = None#
theta: Tensor | None = None#
class scxpand.autoencoders.ae_model_output.ModelOutput(latent_vec, mu, class_logit, pi=None, theta=None, categorical_logits=None)#

Container for autoencoder model outputs.

This class standardizes outputs from all autoencoder model variants, making code more maintainable and error handling more robust. It replaces the tuple return type with a proper object that has named attributes.

Variables:
  • latent_vec – Encoded latent vector from encoder [batch_size, latent_dim]

  • mu – Mean parameter after inverse transforms to match row-normalized target scale [batch_size, n_genes]

  • class_logit – Classification logit [batch_size]

  • pi – Dropout probability [batch_size, n_genes] (optional, only for ZINB)

  • theta – Dispersion parameter [batch_size, n_genes] (optional, only for NB/ZINB, positive values)

  • categorical_logits – Dict of categorical feature logits (optional) {feature_name: [batch_size, n_classes]}

__init__(latent_vec, mu, class_logit, pi=None, theta=None, categorical_logits=None)#
cpu()#
Return type:

ModelOutput

detach()#

Detach all tensors from the computation graph.

Return type:

ModelOutput

get_binary_predictions()#
Return type:

Tensor

to(device)#

Move all tensors to the specified device.

Return type:

ModelOutput

categorical_logits: dict[str, Tensor] | None = None#
class_logit: Tensor#
property device: device#

Get the device of the tensors.

latent_vec: Tensor#
mu: Tensor#
pi: Tensor | None = None#
theta: Tensor | None = None#