MeasureTransport / MeasureTransport/MParT

Expose `MixedGradient`

Open
#388 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
18
Forks
5
PR merge metrics
No merged PRs in 30d

Description

It'd be nice to have a function that exactly gets the diagonal mixed gradient of a PFB, i.e. for a given real-valued function $T(\mathbf{x},y;\mathbf{c})$ for given parameters $\mathbf{c}$, it'd be nice to get the value of $\nabla_\mathbf{c}\partial_y T(\mathbf{x},y;\mathbf{c})$.

In practice, this is possible currently, but it's somewhat annoying (and I'm not really sure how stable it is). In Julia code, you have to do something like this

T = # ...
samples = #...
logdet_eval = LogDeterminant(T, samples)
logdet_grad = LogDeterminantCoeffGrad(T, samples)
mixed_grad = logdet_grad
for j in 1:size(samples,2)
    mixed_grad[:,j] *= exp(logdet_eval[j])
end

This comes from the fact that this mixed gradient is given by
$$\nabla_\mathbf{c}\partial_yT(\mathbf{x},y;\mathbf{c}) = \exp(\log\partial_y T(\mathbf{x},y;\mathbf{c})))\nabla_\mathbf{c}\log\partial_y T(\mathbf{x},y;\mathbf{c})$$
The exponential worries me and it seems like a waste to evaluate two functions when you only need one.

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 by locating the LogDeterminant and LogDeterminantCoeffGrad entry points used in the Julia example, then trace how their underlying operations are exposed. Define the MixedGradient entry point so callers can obtain the diagonal mixed gradient directly without separately evaluating both functions, and verify the public API and relevant behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, julia
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.