Skip to content

"Story trajectories" demo pipeline (smooth -> resample -> zscore -> hyperalign -> UMAP -> windowed animation) cannot be reproduced -- missing manip=, animate='window', focused= #275

Description

@jeremymanning

Imported from jeremymanning#27

Original report: using previous hypertools versions, the demo "story trajectories" gif could be reproduced with:

import hypertools as hyp
import timecorr as tc
from scipy.interpolate import pchip
import numpy as np

def resample(a, n):
    ...  # pchip interpolation to n samples

pieman_data = hyp.load('weights').data
smoothed = tc.smooth(pieman_data, kernel_fun=tc.helpers.gaussian_weights, kernel_params={'var': 50})
resampled = [resample(x, 1000) for x in smoothed]

aligned = hyp.align(resampled, align='hyper')
hyp.plot(aligned, align=True, reduce='UMAP', animate=True, duration=30, tail_duration=4.0, zoom=0.5, save_path='pieman.mov')

The reporter tried a "revamped version" pipeline intended for the newer API:

import hypertools as hyp

data = hyp.load('weights')

manip = [{'model': 'Smooth', 'args': [], 'kwargs': {'kernel_width': 25}},
         {'model': 'Resample', 'args': [], 'kwargs': {'n_samples': 1000}},
         'ZScore']
hyperalign = {'model': 'HyperAlign', 'args': [], 'kwargs': {'n_iter': 2}}

hyp.plot(data, manip=manip, align=hyperalign, animate='window', reduce='UMAP', duration=30, focused=4, zoom=0.5)

but reported it "doesn't seem to work well in practice," and raised open questions:

  • prior versions normalized data by default; does 'ZScore' (vs. e.g. 'Normalize') correctly replace that implicit step?
  • old demo used a Gaussian smoothing kernel (variance 50) vs. the new example's boxcar kernel (width 25) -- does the kernel shape matter?
  • old hyp.align may have implicitly normalized data (possibly twice, once per alignment stage) -- does the new pipeline need to normalize more than once to match?

Current status (as of this migration): the "revamped" repro as written does not run at all against current hypertools:

TypeError: got an unexpected keyword argument 'manip'

hyp.plot() currently has no manip= parameter, no animate='window' mode (valid: True/'parallel'/'spin'/'serial'/'morph'), and no focused= parameter. (The manip= gap is shared with issue #26 -- hyp.manip() exists standalone but can't chain a list of steps either.) Because of this, the deeper normalization/kernel-shape questions this issue actually raises have not yet been investigated end-to-end against the current codebase.

This should stay open, tracking: (1) the API gaps (manip= wiring + list-chaining, shared with #26; animate='window'; focused=), and (2) once those exist, a real side-by-side reproduction of the "story trajectories" demo to answer the normalization/kernel-shape questions above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    high effortEstimated high implementation effort

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions