src.encode_latent_transformer

encode_latent_transformer.py

Encodes longitudinal sensor data into latent representations using a trained Transformer encoder.

This script: - Loads X (and optionally y, timestamps) from an HDF5 file. - Applies a previously trained StandardScaler. - Uses a trained encoder model to produce latent representations. - Saves the encoded features (and metadata if available).

Usage:

python encode_latent_transformer.py –input new_data.hdf5 –encoder models/encoder_transformer.h5 –scaler models/standard_scaler.pkl –output encoded_latent/

Functions

load_and_preprocess(hdf5_path, scaler_path)

Loads and normalizes X from a .hdf5 file using a saved StandardScaler.

main()

Main routine to encode X using a trained Transformer encoder.