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.
Imported from jeremymanning#27
Original report: using previous hypertools versions, the demo "story trajectories" gif could be reproduced with:
The reporter tried a "revamped version" pipeline intended for the newer API:
but reported it "doesn't seem to work well in practice," and raised open questions:
'ZScore'(vs. e.g.'Normalize') correctly replace that implicit step?hyp.alignmay 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:
hyp.plot()currently has nomanip=parameter, noanimate='window'mode (valid:True/'parallel'/'spin'/'serial'/'morph'), and nofocused=parameter. (Themanip=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.