Functional Alignment

Group-wise function alignment using SRSF framework and Dynamic Programming

moduleauthor:: Derek Tucker <dtucker@stat.fsu.edu>

time_warping.align_fPCA(f, time, num_comp=3, showplot=True, smooth_data=False, sparam=25)[source]

aligns a collection of functions while extracting pincipal components. The functions are aligned to the principal components

Parameters:
  • f (np.ndarray) – numpy ndarray of shape (M,N) of M functions with N samples
  • time (np.ndarray) – vector of size N describing the sample points
  • num_comp – number of fPCA components
  • showplot – Shows plots of results using matplotlib (default = T)
  • smooth_data (bool) – Smooth the data using a box filter (default = F)
  • sparam (double) – Number of times to run box filter (default = 25)
Return type:

tuple of numpy array

Return fn:

aligned functions - numpy ndarray of shape (M,N) of M functions with N samples

Return qn:

aligned srvfs - similar structure to fn

Return q0:

original srvf - similar structure to fn

Return mqn:

srvf mean or median - vector of length N

Return gam:

warping functions - similar structure to fn

Return q_pca:

srsf principal directions

Return f_pca:

functional principal directions

Return latent:

latent values

Return coef:

coefficients

Return U:

eigenvectors

time_warping.srsf_align(f, time, method='mean', showplot=True, smoothdata=False, sparam=25, lam=0.0)[source]

This function aligns a collection of functions using the elastic square-root slope (srsf) framework.

Parameters:
  • f (np.ndarray) – numpy ndarray of shape (M,N) of M functions with N samples
  • time (np.ndarray) – vector of size N describing the sample points
  • method – (string) warp calculate Karcher Mean or Median (options = “mean” or “median”) (default=”mean”)
  • showplot – Shows plots of results using matplotlib (default = T)
  • smoothdata (bool) – Smooth the data using a box filter (default = F)
  • sparam (double) – Number of times to run box filter (default = 25)
  • lam (double) – controls the elasticity (default = 0)
Return type:

tuple of numpy array

Return fn:

aligned functions - numpy ndarray of shape (M,N) of M functions with N samples

Return qn:

aligned srvfs - similar structure to fn

Return q0:

original srvf - similar structure to fn

Return fmean:

function mean or median - vector of length N

Return mqn:

srvf mean or median - vector of length N

Return gam:

warping functions - similar structure to fn

Return orig_var:
 

Original Variance of Functions

Return amp_var:

Amplitude Variance

Return phase_var:
 

Phase Variance

>>> import tables
>>> fun=tables.open_file("../Data/simu_data.h5")
>>> f = fun.root.f[:]
>>> f = f.transpose()
>>> time = fun.root.time[:]
>>> out = srsf_align(f,time)

Previous topic

Welcome to fdasrsf’s documentation!

Next topic

Functional Principal Component Analysis

This Page