Skip to main content
. Author manuscript; available in PMC: 2024 Aug 22.
Published in final edited form as: Nat Mach Intell. 2023 May 29;5(6):631–642. doi: 10.1038/s42256-023-00663-z

Algorithm 1.

JAMIE

Input: X,Y,F
Params: τmin,τmax,bs, (α,β,γ), ρ,τmax_lapses,min_change
Output: fEX(), fEY(), fDX(), fDY(), LX,LY
1: KX,KY=[dist(X),dist(Y)]
2: F~=argminα,F¯αKXF¯KYF¯TF2
3: FρF+(1ρ)F~
4: best,τlapses0
5: τcurrent0
6: Initialize fEX,fEY,fDX,fDY with random weights
7: while τcurrent<τmax and τlapses<τmax_lapses do
8:  Randomly sample XsRdX×bs from XRdX×nX and YsRdY×bs from YsRnY×nY
9:  Extract submatrix FsRbs×bs from FRnX×nY and F~sRbs×bs from F~RnX×nY
10:  Optionally transform Xs,Ys using PCA trained on X,Y
11:  Normalize columns of Fs and F~s to summation 1
12:  Randomly sample LiXs from distributions fEXXs and LjYs from distributions fEYYs for i,j1,2,,bs
13: MXsLXs+δLYsFsTdiag1+δFs1bs1
14: MYsLYs+δ1LXsFsdiag1+δ1FsT1bs1
15: X~sfDXMXs and Y~sfDYMYs
16:  If Xs,Ys were transformed using PCA, perform inverse transform on X~s,Y~s
17: κ1+exp5τcurrent0.5τmin0.5τmin1
18:  Calculate kl via Equation 4
19:  Calculate combination via Equation 6
20:  Calculate reconstruction via Equation 7
21:  Calculate alignment via Equation 9
22: totalkl+αcombination+βreconstruction+γalignment
23: if τcurrentτmin then
24:   if total<bestmin_change then
25:    besttotal
26:    τlapses0
27:   else
28:    τlapsesτlapses+1
29:   end if
30: end if
31:  Update fEX,fEY,fDX,fDY using gradient descent on total
32: τcurrentτcurrent+1
33: end while
34: LXfEX(X), LYfEY(Y)