hypertools.reduce.autoencoders.SparseAutoencoder

class hypertools.reduce.autoencoders.SparseAutoencoder(n_components=2, sparsity_weight=0.001, epochs=100, batch_size=64, lr=0.001, hidden_dims=None, device='auto', random_state=None, verbose=False)[source]

A single-hidden-layer autoencoder with an L1 penalty on the hidden activation (sparse coding), encouraging a sparser, more interpretable intermediate representation.

Parameters:
n_componentsint

Latent (bottleneck) dimensionality (default: 2).

sparsity_weightfloat

Weight of the L1 penalty on the mean absolute hidden-layer activation, added to the MSE reconstruction loss (default: 1e-3).

epochs, batch_size, lr, hidden_dims, 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_transform method.

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, sparsity_weight=0.001, epochs=100, batch_size=64, lr=0.001, hidden_dims=None, device='auto', random_state=None, verbose=False)[source]

Methods

__init__([n_components, sparsity_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_transform method.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Apply the already-fitted network to (new) X, without refitting.

Attributes

is_fitted

Whether fit/fit_transform has already been run.