Skip to main content

function_space.SubsetOfData

function_space.SubsetOfData(n_subset=static(), structure='joint')

A subset-of-data GP: condition on \(m\) training inputs drawn uniformly without replacement.

It takes one pass, and keeps every input when there are fewer than \(m\). Each example gets a uniform priority drawn from its batch’s generator, and the \(m\) smallest are kept, so the subset depends on the fit’s seed only. Needs vjp and vmap (the Jacobian at the subset) and the likelihood’s output Hessian. Weighted batches are refused. plan checks MAX_SUBSET_ENTRIES and MAX_SUBSET_JACOBIAN_ENTRIES against \(m\), the probe’s event size and the parameter count, before any data.

Parameters

Name Type Description Default
n_subset int The subset size \(m\), at least 1. static()
structure _Structure How the outputs of one input interact. "joint": the output Hessian as it is and the joint kernel over the outputs. "diagonal": the output Hessian’s diagonal, with the joint kernel; this is the joint FunctionalLaplace of laplace-torch. "independent": the diagonal, and one GP per output (independent_outputs=True in laplace-torch), so at gives diagonal \(E \times E\) blocks. A Gaussian’s output Hessian is already diagonal, so "joint" and "diagonal" agree. 'joint'

Raises

Name Type Description
ValueError n_subset is below 1, or structure is not "joint", "diagonal" or "independent".

Attributes

Name Description
requires Needs vjp, vmap and the output Hessian, and refuses weighted batches.

Methods

Name Description
plan The subset pass, ending in the SubsetGP.

plan

function_space.SubsetOfData.plan(params, ctx, prior, /)

The subset pass, ending in the SubsetGP.

Returns

Name Type Description
Pass[SubsetGP[Any]] The pass. When run, it raises ValueError when the data yields no examples or some batches have targets and others don’t, NotImplementedError when the model does not return a single tensor, and StructureError when the rows it kept break the budgets below.

Parameters

Name Type Description Default
params Params The fitted params, where the model is linearized. required
ctx FitContext The fit’s context. required
prior PriorWithCovariance The prior over params. Its covariance \(\Sigma_0\) enters the kernel. required

Raises

Name Type Description
StructureError With the probe’s event size \(E\) and \(P\) parameters, \(m E\) exceeds MAX_SUBSET_ENTRIES or \(m E P\) exceeds MAX_SUBSET_JACOBIAN_ENTRIES.