hypertools.reduce.autoencoders.Autoencoder

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

A single-hidden-layer (shallow) autoencoder reducer.

The default, cheapest-to-train autoencoder variant: one Linear + ReLU hidden layer on each side of the bottleneck. Good for small to medium tabular data where a deeper network is unnecessary.

Parameters:
n_componentsint

Latent (bottleneck) dimensionality (default: 2). Wired to hypertools.reduce.reduce.reduce’s ndims=.

epochsint

Number of training epochs (default: 100). Must be a non-negative integer (validated at fit time); epochs=0 explicitly skips training, leaving the network at its random initialization (useful only as an untrained baseline).

batch_sizeint

Minibatch size (default: 64). Must be a positive integer (validated at fit time).

lrfloat

Adam learning rate (default: 1e-3). Must be a positive finite number (validated at fit time).

hidden_dimsNone, int, or sequence of int

Hidden layer width. None (default) computes a sensible width geometrically between n_components and the number of input features; an int (or single-element sequence) sets it directly.

devicestr

‘auto’ (default) picks ‘cuda’ > ‘mps’ > ‘cpu’; any other string is passed to torch.device as-is.

random_stateint or None

Seeds torch.manual_seed for reproducible weight initialization and minibatch order (default: None, i.e. nondeterministic).

verbosebool

Print training progress (default: False).

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

Methods

__init__([n_components, epochs, batch_size, ...])

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.