hypertools.reduce.autoencoders.VariationalAutoencoder¶
- class hypertools.reduce.autoencoders.VariationalAutoencoder(n_components=2, kl_weight=1.0, hidden_dims=None, epochs=100, batch_size=64, lr=0.001, device='auto', random_state=None, verbose=False)[source]¶
A variational autoencoder (VAE) reducer: a probabilistic encoder (mean + log-variance heads) trained with a KL-divergence term toward a standard normal prior, via the reparameterization trick. transform/fit_transform return the latent MEANS (not stochastic samples), giving a smooth, reproducible, generative latent space.
- Parameters:
- n_componentsint
Latent dimensionality (default: 2).
- kl_weightfloat
Weight of the KL-divergence term, added to the MSE reconstruction loss (default: 1.0).
- hidden_dimsNone, int, or sequence of int
Hidden layer widths of the shared encoder body / decoder, outermost (closest to the input) first. None (default) computes 2 geometrically-spaced widths.
- epochs, batch_size, lr, device, random_state, verbose
See Autoencoder.
- Attributes:
- net_torch.nn.Module or None
The fitted network.
Methods
fit(X[, y])Fit the autoencoder on X (see fit_transform); returns self.
fit_transform(X[, y])Standardize X, train a fresh network on it, and return the fitted latent codes.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
inverse_transform(Z)Decode latent codes Z back to (standardization-undone) feature space.
set_inverse_transform_request(*[, Z])Configure whether metadata should be requested to be passed to the
inverse_transformmethod.set_params(**params)Set the parameters of this estimator.
transform(X)Apply the already-fitted network to (new) X, without refitting.
- __init__(n_components=2, kl_weight=1.0, hidden_dims=None, epochs=100, batch_size=64, lr=0.001, device='auto', random_state=None, verbose=False)[source]¶
Methods
__init__([n_components, kl_weight, ...])fit(X[, y])Fit the autoencoder on X (see fit_transform); returns self.
fit_transform(X[, y])Standardize X, train a fresh network on it, and return the fitted latent codes.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
inverse_transform(Z)Decode latent codes Z back to (standardization-undone) feature space.
set_inverse_transform_request(*[, Z])Configure whether metadata should be requested to be passed to the
inverse_transformmethod.set_params(**params)Set the parameters of this estimator.
transform(X)Apply the already-fitted network to (new) X, without refitting.
Attributes
is_fittedWhether fit/fit_transform has already been run.