Quick start notebook for HePPCAT.jl

8.6 μs

Step 1: load the package.

16.2 μs
5.8 s

Step 2: form data into a Vector with Matrix elements - each matrix is a group of samples (columns) having equal noise variance.

19.5 μs
20.9 ms

This code generates an example synthetic dataset with heteroscedastic noise: the n[1] = 800 samples in X[1] have noise variance v[1] = 10.0, and the n[2] = 200 samples in X[2] have noise variance v[2] = 0.01.

17.3 μs

Step 3: run the heppcat method.

30.7 μs
model
33.4 ms

For more info, use ?heppcat to access the docstring.

12.4 μs

Step 4: extract factor matrix and noise variance estimates.

10.2 μs
100×1 Array{Float64,2}:
  0.09540347619500922
 -0.04612378197439529
 -0.045070492438695216
  0.15816842057057826
 -0.14001851170110163
  0.052775176733916136
  0.17413606043592242
  ⋮
  0.0035617725811919786
  0.0018237030017226028
 -0.10913235212189487
 -0.008591217324997152
  0.09933617736569156
 -0.1207851712957901
8.4 μs
146 ns

For more info about the returned datatype use ?HePPCATModel for the docstring.

17.8 μs

Evaluating recovery: check recovery of the factor covariance and noise variances.

13.1 μs
2.5 ms
0.517880090519894
86.9 μs
2×2 Array{Float64,2}:
 10.0689      10.0
  0.00997343   0.01
2.0 μs

Compared with homoscedastic PPCA:

10.7 μs
ppca
15.1 ms
7.769109021285145
79.7 μs
2×2 Array{Float64,2}:
 8.00306  10.0
 8.00306   0.01
2.0 μs

HePPCAT accounts for heterogeneous quality among the samples and is generally more robust.

9.0 μs