NeuralTSNE.TSNE.ParametricTSNE package
Submodules
NeuralTSNE.TSNE.ParametricTSNE.parametric_tsne module
- class ParametricTSNE(loss_fn: str, perplexity: int, batch_size: int, early_exaggeration_epochs: int, early_exaggeration_value: float, max_iterations: int, n_components: int | None = None, features: int | None = None, multipliers: List[float] | None = None, n_jobs: int = 0, tolerance: float = 1e-05, force_cpu: bool = False, model: NeuralNetwork | Module | OrderedDict | None = None)[source]View on GitHub
Bases:
object
Parametric t-SNE implementation using a neural network model.
- Parameters:
loss_fn (str) – Loss function for t-SNE. Currently supports kl_divergence.
perplexity (int) – Perplexity parameter for t-SNE.
batch_size (int) – Batch size for training.
early_exaggeration_epochs (int) – Number of epochs for early exaggeration.
early_exaggeration_value (float) – Early exaggeration factor.
max_iterations (int) – Maximum number of iterations for optimization.
n_components (int, optional) – Number of components in the output. Defaults to None.
features (int, optional) – Number of input features. Defaults to None.
multipliers (List[float], optional) – List of multipliers for hidden layers in the neural network. Defaults to None.
n_jobs (int, optional) – Number of workers for data loading. Defaults to 0.
tolerance (float, optional) – Tolerance level for convergence. Defaults to 1e-5.
force_cpu (bool, optional) – Force using CPU even if GPU is available. Defaults to False.
model (Union[NeuralNetwork, nn.Module, OrderedDict], optional) – Predefined model. Defaults to None.
- create_dataloaders(train: Dataset, test: Dataset) Tuple[DataLoader | None, DataLoader | None] [source]View on GitHub
Create dataloaders for training and testing sets.
- Parameters:
train (Dataset) – Training dataset.
test (Dataset) – Testing dataset.
- Returns:
Tuple containing training and testing dataloaders.
- Return type:
Tuple[DataLoader | None, DataLoader | None]
- read_model(filename: str)[source]View on GitHub
Load the model’s state dictionary from a file.
- Parameters:
filename (str) – Name of the file to load the model.
- save_model(filename: str)[source]View on GitHub
Save the model’s state dictionary to a file.
- Parameters:
filename (str) – Name of the file to save the model.
- set_loss_fn(loss_fn: str) Callable [source]View on GitHub
Set the loss function based on the provided string.
- Parameters:
loss_fn (str) – String indicating the desired loss function.
- Returns:
Corresponding loss function.
- Return type:
Callable
Note
Currently supports kl_divergence as the loss function.
- split_dataset(X: Tensor, y: Tensor = None, train_size: float = None, test_size: float = None) Tuple[DataLoader | None, DataLoader | None] [source]View on GitHub
Split the dataset into training and testing set
- Parameters:
X (torch.Tensor) – Input data tensor.
y (torch.Tensor, optional) – Target tensor. Default is None.
train_size (float, optional) – Proportion of the dataset to include in the training set.
test_size (float, optional) – Proportion of the dataset to include in the testing set.
- Returns:
Tuple containing training and testing dataloaders.
- Return type:
Tuple[DataLoader | None, DataLoader | None]
Note
Splits the input data into training and testing sets, and returns corresponding dataloaders.