Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional structured latent-space regularization to BlueMath_tk
autoencoders, with the goal of providing a more interpretable,
PCA-like latent geometry while retaining nonlinear autoencoder models.
Three modes are supported:
latent_structure="none"— preserves existing behavior.latent_structure="orthogonal"— encourages an orthonormal latentprojection and decorrelated latent scores.
latent_structure="pca_like"— adds ordered-prefix training so earlierlatent coordinates are encouraged to retain more reconstruction utility.
The feature is integrated into:
The existing
OrthogonalAutoencoderremains unchanged.Mathematical formulation
Projection orthogonality is regularized using
mean((W W^T - I)^2).Latent decorrelation uses the mean squared off-diagonal Pearson
correlations of the unmasked latent scores.
The calculation removes each coordinate's scale before normalization,
making the objective invariant to representable nonzero independent
coordinate rescaling.
For an exactly collapsed coordinate, Pearson correlation is undefined.
Pairs involving such coordinates receive the maximal squared-correlation
penalty of
1.0, preventing collapse from reducing the objective.pca_likeadditionally uses stochastic ordered-prefix masking duringtraining. The regularization terms themselves are calculated from the
unmasked latent representation.
VAE behavior
For VariationalAutoencoder:
mu;mu;Backward compatibility
latent_structure="none"preserves the existing behavior.devicearguments retain their historical position.nn.Linearweight/biasstate-dict keys and do not add trainable parameters.configuration rather than silently retaining incompatible settings.
Diagnostics
Adds latent diagnostics including:
Correlation diagnostics use the same scale-invariant Pearson semantics as
the training regularizer.
Validation
Local regression suite:
893 passed, 113 warningsgit diff --check: PASSA fixed-configuration synthetic holdout used fresh seeds 47, 101 and 131,
separate from calibration seeds 2, 11 and 23.
Research configuration:
latent_orthogonality_weight = 1.0latent_decorrelation_weight = 0.1latent_ordering_probability = 0.5All predefined holdout criteria passed.
Mean holdout results:
Interpretation
“PCA-like” here refers to a row-orthogonal latent projection,
decorrelated latent scores, and ordered-prefix reconstruction utility.
It does not imply PCA variance optimality, explained-variance ordering,
principal-component recovery, or equivalence between a nonlinear
autoencoder and PCA.
The calibrated regularization values above are reference research
settings rather than universal defaults; dataset-specific work should
tune them using training/validation data only.