Skip to content

autoencoder

polars_ts.clustering._autoencoder

Autoencoder and clustering layer for deep embedded clustering.

TSAutoencoder

Bases: Module

1D convolutional autoencoder for time series.

Parameters

seq_len Length of (padded) input sequences. embedding_dim Dimension of the bottleneck embedding. n_filters Base number of convolutional filters.

encode(x)

Return bottleneck embedding.

decode(z)

Reconstruct from embedding.

forward(x)

Return (embedding, reconstruction).

ClusteringLayer

Bases: Module

Soft assignment via Student's t-distribution (DEC).

Parameters

n_clusters Number of clusters. embedding_dim Dimension of input embeddings. alpha Degrees of freedom of the Student's t-distribution. Default 1.0.

forward(z)

Compute soft cluster assignments q_ij.

target_distribution(q)

Compute sharpened target distribution from soft assignments.

Squares and normalizes q to produce a sharper auxiliary target that emphasizes high-confidence assignments.