PLab

PLab contains MATLAB functions for the following procedures:

v1.1: Topological feature extraction

  • Persistent homology on a signal

  • Persistence features: barcode, persistence, persistence landscape

  • Exercise sheet

v1.2: Topological inference (currently in review)

  • Exact test on persistence landscapes

A demo script and simulation exercise are provided in each version of the package.

Please fill out the form (link) to download the package for learning, teaching, and research purpose only.

If you use the package for your work, please use the following citations:

Wang, Y., Ombao, H., Chung, M.K. (2018). Topological data analysis of single-trial electroencephalographic signals. Annals of Applied Statistics. 12(3):1506-1534.

Wang, Y., Ombao, H., Chung, M.K. (2019). Statistical persistent homology of brain signals. Proceedings of the 44th IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) 1125 – 1129.

The following demo is built on the simulation settings of Wang et al (2018, 2019).

Generate 4 signals of increasing frequencies

T = 2*pi;ts = 500; % number of time points in a signalparas = 4; xx = linspace(0,T,ts);omega = [1 2 5 10]; signal = zeros(paras,ts); for para=1:paras signal(para,:) = xx.*cos(omega(para)*xx);end figure; for para=1:paras subplot(paras,1,para);plot(xx,signal(para,:),'black');end

Construct barcodes for the signals

The construction requires a pairing algorithm that pairs the unique local minimums and maximums the Elder Rule.

bars = cell(1,paras);

for para = 1:paras

[count,critx,crity,M,bars{para}] = barcode(xx,(signal(para,:)-min(signal(para,:)))./(max(signal(para,:))-min(signal(para,:))));

end

figure;

for para = 1:paras

subplot(1,paras,para);

for i = 1:size(bars{para},1)

plot([bars{para}(i,1),bars{para}(i,2)],[i,i],'LineWidth',2);

hold on;

end

end

Construct persistence landscapes based on the barcodes

m = 100;

bars = cell(1,paras);

left = zeros(1,paras);

right = zeros(1,paras);

pl = cell(1,paras);

for para = 1:paras

[count,critx,crity,M,bars{para}] = barcode(xx,signal(para,:));

left(para) = min(min(bars{para}));

right(para) = max(max(bars{para}));

pl{para} = PL(bars{para},left(para),right(para),m); % first row is left:right with m intervals

end

figure;

for para = 1:paras

subplot(1,paras,para);

for l = 2:size(pl{para},1)

surf(pl{para}(1,:),(l-1):0.2:l,repmat(pl{para}(l,:),6,1));

hold on;

end

view([-185 10]);

end