Skip to content

Extract the duplicated sparse-predict projection block in variational families #678

Description

@thomaspinder

Category: simplify · Severity: medium
Location: gpjax/variational_families.py:283-307 (+ :435-449, :599-622, :759-782)

Problem

The projection block in VariationalGaussian.predict (Lz⁻¹Kzt, Kzz⁻¹Kzt, Ktt − Q_tt + proj, add_jitter, wrap) is copy-pasted essentially verbatim into three more predicts (whitened, natural, expectation) — ~75 duplicated lines of numerics that can silently drift apart.

Recommendation

Extract one _sparse_predict(mu, sqrt, Lz, ...) helper shared by the families.

Filed from the 2026-07-02 GPJax codebase audit (medium tier). Companion spec for the high-severity items: plans/2026-07-02-audit-high-severity-remediation-design.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjax-compatibilityrefactoringRefactoringv1.0-resolvedNo longer relevant: resolved or made obsolete by the v1.0 conditioning refactorvariational

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions