September 12, 2013

Goals:

- ground truth - trace datasets 7 through 10
- build new attachment covariance
- reconstruct ground truth using new attachment covariance
- work attachment covariance function into ml

See `attachment/construct_attachment_covariance.m`

(filename still in flux).

Issue: The recursive definition of the attached curve kernel that we outlined yesterday is too expensive to implement naively. Can implement by re-using precomputed values, but the branch point isn't necessarilly one of the observed points, so it's not necesarilly represented in the curve's `prior_K`

. This means we need to construct covariance entries between each of the attachment points and their parent and child curves. Then we can run the "memoized" recursive function.

Key idea: each child curve has a "base self covariance" that is extra covariance inherited from the branch point on parent that is added to all points of the curve self-covariance matrix. That curve, in turn, has a base covariance, that *it* inherits, all the way to the root, whose base covariance is the "position variance" parameter. Thus, the leaves have a base covariance that is the sum of all the incremental variance of all the branches to the root.

The base covariance is an NxN matrix, where N is the number of views. We construct each in isolation, and then cumulatively sum them from root to leaf.

Every element of the curve's observed-point covariance matrix is increased by the base_covariance relative to it's entry; e.g. if element (k_{ij}) is the covariance between a point in view 3 and a point in view 5, you'll add the (3,5) element of the base covariance matrix.

Each child curve also hase a "parent covariance" (for lack of a better term), which is the set of covariances between the branch point and each of the parent points. Again, this is inherited recursively; just as the curve's covariance has it's self-covariance added, the parent covariance has the paren'ts self-covariance added.

This will be used for the off-diagonal blocks of the full attachment covariance matrix.

Issues during implementation and testing of `construct_attachment_covariance`

replacing Cell-of-structs with struct-array:

```
Corrs = cell2mat(Corrs);
```

The trivial code path of calling `blkdiag`

takes 500ms. Wow!

Running on the WACV dataset is giving bad results.

Looks like the covariance matrix is different from the one in the reference implementation.

TODO:

- Need to convert from "index of branch index" to simply "branch index".
- More debugging.