loki2.models.classifier.linear_classifier
Cell Classification Module for Loki2.
This module provides a linear classifier for cell type classification based on cell embeddings.
Module Contents
- class loki2.models.classifier.linear_classifier.LinearClassifier(embed_dim: int, hidden_dim: int = 100, num_classes: int = 2, drop_rate: float = 0)
Bases:
torch.nn.ModuleLinear Classifier for cell type classification.
A two-layer fully connected network with ReLU activation and optional dropout for classifying cells based on their embeddings.
- Parameters:
embed_dim – Embedding dimension (input dimension).
hidden_dim – Hidden layer dimension. Defaults to 100.
num_classes – Number of output classes. Defaults to 2.
drop_rate – Dropout rate. Defaults to 0.
- fc1
- fc2
- activation
- dropout
- forward(x: torch.Tensor) torch.Tensor
Forward pass through the classifier.
- Parameters:
x – Input tensor of shape (batch_size, embed_dim).
- Returns:
Output logits of shape (batch_size, num_classes).
- Return type:
torch.Tensor