GPFA Port Notes
The local MATLAB reference is /Users/jonathanhuml/Desktop/gpfa-matlab.
The Python Elephant reference is:
https://github.com/NeuralEnsemble/elephant/tree/master/elephant/gpfa.
The implementation in zynamics.models.gpfa is being moved toward the Elephant
Python structure while keeping tensors in PyTorch:
gpfaEngine.m: initializegamma,eps,C,d, and diagonalR.fastfa.m: initializeC,d, andRwith factor analysis.exactInferenceWithLL.m: run the GPFA E-step and compute likelihood.em.m: updateC,d,R, then learn GP kernel parameters.learnGPparams.mandgrad_betgam.m: update each RBFgammafrom posterior autocovariance sufficient statistics.
Current Elephant-aligned choices:
- Elephant uses
sklearn.decomposition.FactorAnalysis; zynamics ports the same FA EM objective in torch to avoid adding sklearn to the model dependency surface. - Elephant uses SciPy
L-BFGS-Bforgrad_betgam; zynamics uses PyTorch autograd withtorch.optim.LBFGSon the equivalent objective. - Elephant exposes both raw latent trajectories and
latent_variable_orth. Zynamics now returns raw latents inModelOutput.latentsand orthonormalized latents plusCorthinModelOutput.extras.
Orthonormalization is postprocessing for latent visualization. It should not change decoded firing-rate predictions unless the latent trajectories and the loading matrix are transformed consistently.
The benchmark epoch definition is unchanged: one GPFA epoch is one full E-step,
one C/d/R M-step, and the associated gamma optimization using the E-step
sufficient statistics.