pymc-devs / pymc-devs/ptgp

InducingVariables API design: structured solve interface for Points, VFF, and Spherical Harmonics

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
8
Forks
4
Avg merge
2d 2h
Merged PRs (30d)
4

Description

With VFF landing in #3 and spherical harmonics (Dutordoir et al. 2020) planned, we need to settle the InducingVariables abstraction.

Current interface

SVGP dispatches through the inducing variable, which implements:

  • K_uu(kernel) — dense Kuu (for compatibility/debugging)
  • K_uf(kernel, X) — cross-covariance between inducing variables and data
  • Kuu_solve(kernel, rhs) — Kuu^{-1} @ rhs
  • Kuu_sqrt_solve(kernel, rhs) — R^{-1} @ rhs where R @ R.T = Kuu
  • Kuu_logdet(kernel) — log determinant of Kuu

The base class provides dense defaults for the solve/sqrt_solve/logdet methods. Subclasses override with structured implementations.

Subclasses and their Kuu structure

Subclass Kuu structure Solve strategy
Points Dense (M, M) Dense defaults (no override needed)
FourierFeatures1D diag + low-rank Woodbury identity
Spherical Harmonics (future) Diagonal Elementwise division

None of the structured subclasses have a .Z attribute. Points does.

Initialization and validation are subclass-specific

greedy_variance_init, kmeans_init, and random_subsample_init are specific to Points. They select locations in input space, which doesn't apply to spectral methods. VFF is configured by domain bounds and frequency count, SH by truncation level. These should stay separate from the base interface.

Domain validation (_domain_check) is also subclass-specific. VFF needs to check that inputs fall within [a, b]. SH may need to check that inputs are on the sphere. Points doesn't need any check.

Open questions

  • Is .Z a Points-only attribute, or should there be a base-class method for "give me something plottable/inspectable" that other subclasses can implement differently?
  • Should _domain_check be a formal optional method on the base class, or stay informal (hasattr dispatch)?
  • Where should initialization utilities live and be organized? greedy_variance_init, kmeans_init, and random_subsample_init are currently in ptgp/inducing.py alongside the base class, but they're Points-specific. VFF and SH will have their own initialization patterns (from_data, frequency/truncation config). Should each subclass module own its init utilities, or should there be a shared ptgp/init/ namespace? These utilities also need to be accessible to Claude Code skills files for VFF and SH workflows.
  • Does Points actually need K_uu, K_uf, and the solve/sqrt_solve/logdet methods? Before VFF, Points just held .Z and SVGP called kernel(Z) directly. The new methods on Points are thin wrappers (K_uu calls kernel(self.Z), K_uf calls kernel(self.Z, X)). Is that indirection worth it for API consistency, or should Points stay simple and SVGP only dispatch through the structured methods when the inducing variable isn't Points?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ptgp/inducing.py and trace how SVGP dispatches through InducingVariables. Compare Points and FourierFeatures1D, including their Kuu structures, solve methods, domain checks, and initialization utilities. Done means the API boundaries, subclass ownership, and treatment of Points attributes are decided clearly enough to guide future spherical-harmonics work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.