My blogs reporting quantitative financial analysis, artificial intelligence for stock investment & trading, and latest progress in signal processing and machine learning

Thursday, May 31, 2012

More About the BSBL Codes and Demo Files for Telemonitoring of Physiological Signals

I got several emails asking some questions on the BSBL codes, especially the demo files for telemonitoring of fetal ECG in the package. I listed these questions and provided my answers:

1. Why provided the sensing matrix Phi in the software package?
     The Phi.mat in the software package stores a binary sparse matrix, which is used as the sensing matrix. But I have to emphasize that it is not an optimal sensing matrix. I just randomly generated it and then stored it and used it for all my experiments. This can help people exactly reproduce my results (When the dataset is given, different sensing matrices can result in slightly different performance).  As you know, designing an optimal sparse sensing matrix is an important direction in compressed sensing.

2. Can the demo files for telemonitoring of fetal ECG be directly used in a telemonitoring system?
     The demo files for telemonitoring of fetal ECG are just a mimicking of telemonitoring. In a real system, each channel recording should be processed by a BSBL-BO algorithm (parallel computation), and may need to use online ICA algorithms or at least on-line batch algorithms. The ICA algorithm used in the demo files is an off-line algorithm. You can use the (Extended-) Infomax algorithm, an online algorithm which can be accessed from the EEGLab.

3. Have you made  any real telemonitoring systems using the algorithm?
    The second author (Prof. Tzyy-Ping Jung) has led a team to build real-time telemonitoring systems for EEG, and some products have being sold in Taiwan.
    But these systems have not used compressed sensing technique. However, we are now considering to incorporate some BSBL algorithm. For your interests, please check the following links to see the videos on these telemonitoring systems for various applications:
4. Can BSBL-BO work well when used in the in-direct recovery way (i.e. first recovering the representation coefficients of the signal in some transformed domain, and then recovering the original signal)?
    Yes, of course. In the DEMO_nonSparse.m I also give an example when BSBL-BO first recovers the DCT coefficients and then recovers the original fetal ECG. The performance is improved in this way. But such method does not work well for all physiological signals. In my experiments on some public EEG and EMG datasets, BSBL-BO using this method may have poorer performance than not using this method. 

5. Speed Improvement
     I am very glad that some people are interested in the BSBL-BO and want to try in their work. Please note the code is not optimized for speed. I chose a coding style for readability instead of for speed. There are some ways to improve the code:
     (1) Remove many "if-" in the code. The current code considers many simulation scenarios, such as block sparsity model with known partition (identical block size or random block size), with unknown partition, and recovery of non-sparse structured  signals, etc. According to your problem, you can remove those unnecessary parts.
     (2) There is a matrix inverse in each iteration. You can replace the current method by other fast matrix inverse method (check matrix computation textbooks), or consider the fast strategy used in Tipping and Faul (2003).
     (3) The updating of the intra-block correlation value in each iteration is not necessary. In some cases, you can figure out a good value according to a priori information. Also, the updating of noise variance in each iteration is not necessary.
     (4) Although I have said that BSBL-L1 is not suitable for telemonitoring of non-sparse physiological signals in the paper, later I found when replacing the group-Lasso type algorithms in the BSBL-L1 with some specific algorithms, we can get good performance with dramatically accelerated speed.
    Of course, as the author of the algorithm, I am responsible for making the code more efficient. When I have time, I will improve it along these ways. But in the near future I have no time to further improve it (Currently I am now deriving SBL algorithms to solve multi-modal/multi-dataset/longitudinal problems in neuroimaging). If you have improved it, or if you want to improve it, please let me know. I would like to share my ideas with you, and collaboration is welcome.

Wednesday, May 30, 2012

Codes of the BSBL Family and Demos for Telemonitoring of ECG have been updated

I have updated the codes of the BSBL family (including BSBL-EM, BSBL-BO, and EBSBL-BO). Their speed is twice of the old versions. Further, they are not sensitive to the scaling of the practical datasets, compared to the old versions.

The download link is here: (Sometimes the link does not work. But you can download it from the bottom of the page:

Furthermore, I added a fold, which contains the demo files to perform the experiment in my post ("", including using BSBL-BO to recover the raw recordings, and then using FastICA to do ICA decomposition. If you think there are other algorithms can do the work as BSBL-BO, you can use the demo files to try your favorite algorithms. And I will be very glad if you send your results to me.

I will release the code of BSBL-L1 soon.

Since tomorrow, I will modify the T-MSBL group. I am very sorry that the old version of T-MSBL is slow. There is due to some reasons. I have modified the code, and the speed is at least twice of the old one. In addition, I will release other variants of T-MSBL soon.

Is compressed sensing really useful for wireless telemonitoring of non-sparse physiological signals (Part 3)?

In the last post, the signal to recover is much easy, because the two fetal QRS complexes are relatively strong. Now I show you another example, in which the fetal QRS complexes are almost invisible.

Below are 8-channel abdominal recordings (download link can be found in [1]). The peaks you see are the maternal ECG's QRS complexes, which we are not interested in. What we are interested in are the QRS complexes of fetal ECG, which peak around 6, 217, 433, 643, 854, 1065, 1278, 1488, 1697, 1912, 2110, 2317 sampling points. However, you almost can't observe such peaks in each channel recording, since the fetal ECG is very weak and is buried in noise. So, any sparsifying processing can completely remove the fetal ECG QRS complexes.
The 8 recordings are compressed using the same binary sparse matrix A in my last post, and recovered by BSBL-BO using the same input parameters (using the direct recovery way). Results are shown below:
Apparently, the whole 8-channel recordings are recovered well. But note that the recovered recordings will be processed by independent component analysis (ICA) to extract a clean fetal ECG. Therefore, if there is any small distortion in the recovered recordings (the distortion may be not discernible but could destroy the mutual structure across the channel recordings), the ICA decomposition of the recovered recordings will be different from the ICA decomposition of the original recordings. To ensure the ICA decomposition is unchanged is crucial to practical clinical diagnosis.

Hence, we perform ICA decomposition on the recovered recordings using FastICA, and for comparison, we also perform the same ICA decomposition on the original recordings. The ICA decomposition of the original recordings is given below:

The ICA decomposition of the recovered recordings is given below:

Clearly, there is no significant difference between the two ICA decompositions. More importantly, the separated fetal ECG and maternal ECG from the recovered recordings are the same as those from the original recordings. For you convenience, I zoom in some of the separated components. Below are the separated maternal ECG (a)(b) and fetal ECG (c) from the original recordings:
And below are the separated maternal ECG (a)(b) and fetal ECG (c) from the recovered recordings:

Clearly, the fetal ECG separated from the recovered recordings is almost the same as the one separated from the original recordings.

Note that, in this task the BSBL-BO recovered the 8- recordings using the direct recovery method (without first recovering the representation coefficients and then reconstructing the original recordings) as stated in my last post. The results show the BSBL-BO is very powerful to recover non-sparse structured signals.

As I said early, the in-direct recovery method, i.e. first recovering the representation coefficients and then reconstructing the original recordings, is not effective in every situation, because for the applications considered here, small representation coefficients (in transformed domain) are very important and should be recovered. In [1] I have compared several well-known algorithms, which used the in-direct method. They all recovered the significant representation coefficients, and thus the maternal ECG could be obtained from the ICA decompostion. However, the ICA decompositions of their recovered recordings were still largely different from the genuine ICA decomposition, and no fetal ECG could be obtained. This is because the representation coefficients in the transformed domain are still not sparse enough, and these algorithms could not recover the majority of small representation coefficients. Interested readers can refer to Fig.13 in [1].

PS: Using the in-direct recovery method, BSBL-BO can get better performance.

We have other results when using BSBL-BO to recover EEG for brain-computer interface. We are now revising the paper. Once we have done, I will post the paper in my homepage.

[1] Zhilin Zhang, Tzyy-Ping Jung, Scott Makeig, Bhaskar D. Rao, Low Energy Wireless Body-Area Networks for Fetal ECG Telemonitoring via the Framework of Block Sparse Bayesian Learning, submitted to IEEE Trans. on Biomedical Engineering

Is compressed sensing really useful for wireless telemonitoring of non-sparse physiological signals (Part 2)?

In my last post, I have discussed the difficulties when using compressed sensing in wireless telemonitoring of non-sparse physiological signals. Essentially, these difficulties come from the requirements of practical use: the recovered signals  are generally further processed by other signal processing algorithms (e.g. independent component analysis) and/or pattern recognition algorithms (e.g. classification); some small characteristics in signals, although not salient, are very important for diagnosis (e.g. the QRS complexes of fetal ECG in raw abdominal recordings, the P-wave and T-wave in abnormal ECG recordings, the spike duration in EMG, and the fluctuation in some EEG signals). In the following, I will give you examples and show the results of the BSBL-BO algorithm.

The first example is the recovery of raw fetal ECG recordings (recorded from the mother's abdomen).

First, I use the fetal ECG recording in my last post to show the use of BSBL-BO. The recording contains one large peak (the QRS complex of the mother's ECG, which is not of interest) and two small peaks (the QRS complexes of the fetus' ECG, which is of interest), and large noise fluctuation. The recording can be viewed as a signal with block structure (the three peaks are blocks) but contaminated by strong noise (it's 'source noise', not the 'sensor noise' as in standard noisy compressed sensing model). Denote the recording by x. And it is compressed to y by: y = Ax, where A is a 125 x 250 binary sparse matrix (see [1] for details). .

Now I use BSBL-BO to recover x from y using A. Although BSBL-BO requires to know the block partition, we have pointed out that the block partition is in fact a regularization helping learn the covariance matrix of the signal in high dimensional space, and experiments also support that the user-defined block partition does not need to be consistent with the true block partition of the signal. Therefore, I randomly set the block partition like this: [1, 26, 51, 76, 101, ...], where each number indicates the starting location of each block.

If you are familiar with SBL algorithms, you must know SBL algorithms generally have a pruning-mechanism, namely they use a threshold to prune out some irrelevant coefficients. BSBL-BO also has such pruning-mechanism. But note that in this example, the recording x is a non-sparse signal; its every entry is non-zero. Therefore, I need to turn off the pruning-mechanism. This can be done by setting the input argument 'prune_gamma' to any non-positive constant (e.g. -1, 0).

Clearly, there is strong intra-block correlation in x. So we need to explore and exploit the intra-block correlation for better performance. This can be done by setting the input argument 'learntype' to 1 in the BSBL-BO code.

Then, running the algorithm, I get the results as shown below:
The top picture shows the original recording x, the second picture shows the result when exploiting the intra-block correlation, and the last one shows the result when ignoring the intra-block correlation. Clearly, when exploiting the intra-block correlation, the original signal can be recovered with high quality; the fetus' QRS complexes are recovered well.

I encourage you to repeat the above experiment using the demo code 'DEMO_nonSparse' in the package: the link does not work. But you can download it from the bottom of the page:

I should emphasize: in the task BSBL-BO is directly recovering a non-sparse signal, namely, using y and A to directly recover the non-sparse x from the underdetermined inverse problem: y=Ax. I didn't see any other algorithms can successfully do this (In [1] I compared many representative algorithms).

Of course, we can assume that x is represented in other domain (i.e x = Bz), and first recover the representation coefficients z by solving the inverse problem y=(AB) z, and then recover the original signal x  by x = Bz. Using this method, BSBL-BO can get better result (using the same input parameters). And I believe, using this method, some existing algorithms may recover x as well. But note that, when other algorithms adopt this method to recover a non-sparse signal, they heavily rely on how sparse the representation coefficients z are. In fact, for more practical scenarios in telemonitoring, z is not sparse enough. In the next post, I will show you another example (should surprise you!).

[1] Zhilin Zhang, Tzyy-Ping Jung, Scott Makeig, Bhaskar D. Rao, Low Energy Wireless Body-Area Networks for Fetal ECG Telemonitoring via the Framework of Block Sparse Bayesian Learning, submitted to IEEE Trans. on Biomedical Engineering

Monday, May 28, 2012

Is compressed sensing really useful for wireless telemonitoring of non-sparse physiological signals (Part 1)?

Applying compressed sensing to wireless telemonitoring of physiological signals is not new. There have been a number of work published in recent years. However, the achievement is very limited.

This is because the following reasons:

1. Most published work were only successful on few types of physiological signals, such as adult ECG. This is because these signals are relatively sparse (or become sparse after some sparsifying processing). However, most physiological signals are non-sparse, such as fetal ECG, EEG, EMG, etc.

2. Current published work required that signals contain less noise and interference (otherwise the noisy signals are not sparse). However, the main goal of wireless telemonitoring is to allow people can walk freely at home or office. Thus artifacts/interference from muscle movement is unavoidable.

3. Most published work required some sparsifying pre-processing, namely setting the entries of signals with small values to zero. This sparsifying pre-processing requires some complicated techniques to set a threshold (used to set the entries to zero). But the sparsifying pre-processing has three crucial problems:
   (1) These techniques change the underlying structure in signals. For fetal ECG, which is very weak and even invisible in the recorded signals, this technique can completely remove the fetal ECG's QRS complexes.
   (2) These techniques need to occupy extra on-chip computation and thus consume extra energy, while energy consumption is a crucial problem in wireless telemonitoring.
   (3) The setting of thresholds may have problems in practical scenarios, such as when people are walking or in some abnormal situations (remember the target market of telemonitoring is for patients).

4. More importantly, practical wireless telemonitoring systems generally collect/send multi-channel signals. For example, in telemonitoring of EEG for BCI, the channel number generally ranges from 2 to 8; in telemonitoring of fetal ECG, the channel number generally ranges from 4 to 12. These multi-channel signals are sent to remote terminals and will be further processed by other advanced signal processing techniques, such as independent component analysis (ICA). These multi-channel signal processing techniques require that the underlying structure across multi-channel signals is intact. For example, ICA requires the underlying ICA mixing structure in collected multi-channel signals is intact. Therefore, a practical telemonitoring system requires that the raw physiological signals can be completely recovered even including the noise/interference contained in the recorded signals. In other words, this requires the non-sparse signals can be completely recovered, including its entries with small amplitudes

Clearly, we can see, if a compressed sensing algorithm can be widely used in wireless telemonitoring, it must has the ability to recover non-sparse physiological signals, which completely contradicts the sparsity assumption in all the compressed sensing algorithms.

One may ask, there is another way for compressed sensing of non-sparse signals: suppose a non-sparse signal can be represented in a transform domain (e.g. wavelet domains, DCT domains, etc), such that the representation coefficients are sparse, i.e.,
x = Bz,
where x is the signal, B is the basis of the transform domain, and z is the representation coefficients. Then, the signal x is compressed by,
y = Ax,
where y is the compressed signal, and A is the sensing matrix. In the remote terminal, the compressed data y and the matrix product AB are used to recover the sparse coefficients z  according to the relation: y = (AB) z. And then the original signal x is recovered by the relation x = Bz.

However, the success of this method relies on the sparsity of the representation coefficients z. Unfortunately, for most physiological signals, z is not sparse enough, and completely recovering z is still a challenge for most compressed sensing algorithms (especially the sensing matrix A is a binary sparse matrix, a requirement of telemonitoring with low energy consumption).

Here is an example. We transform a segment of fetal ECG signal into the DCT domain, and see the representation coefficients:

As we can see, the coefficients are still not sparse. There are many coefficients with small values. For any compressed sensing algorithms, it is not a problem to recover the big coefficients, but is a big problem to recover the small coefficients. Remember, recovering the small coefficients is very important to maintain the underlying structure of signals, especially for later multi-channel signal processing. For this example, recovering the small coefficients is important to recover the fetal ECG's QRS complexes (i.e. the peaks at 65 and 180 in figure(a)) and to maintain the underlying structure for later ICA decomposition (the goal is to use ICA to extract the weak fetal ECG, not just to recover the noisy recording).

In the next post, I will introduce my work:

Zhilin Zhang, Tzyy-Ping Jung, Scott Makeig, Bhaskar D. Rao, Low Energy Wireless Body-Area Networks for Fetal ECG Telemonitoring via the Framework of Block Sparse Bayesian Learning, submitted to IEEE Trans. on Biomedical Engineering

and I will show you how to use my BSBL-BO algorithm to break through the bottleneck in wireless telemonitoring using compressed sensing.

Sunday, May 27, 2012

New Papers on Sparse Bayesian Learning (SBL)

I was super busy these days, and I am sorry that I have not updated my blog for a long time. Finally, I can find some time to write some things.

First, I've uploaded our CVPR 2012 paper on my website. I will upload the code tomorrow.

Jing Wan*, Zhilin Zhang*, Jingwen Yan, Taiyong Li, Bhaskar D. Rao, Shiaofen Fang, Sungeun Kim, Shannon Risacher, Andrew Saykin, Li Shen, Sparse Bayesian Multi-Task Learning for Predicting Cognitive Outcomes from Neuroimaging Measures in Alzheimer's Diseas, CVPR 2012 (*equal contribution)

I've uploaded my work on wireless telemonitoring of fetal ECG using compressed sensing. I planed to release the code once I have finally tested the code and optimized it. But since I listed the paper on my homepage, I received many emails asking for the code (Wow, it seems that many people are interested in telemonitoring/BCI, and are curious how compressed sensing is helpful to this field). So I am going to release the code of debug version tomorrow:

Zhilin Zhang, Tzyy-Ping Jung, Scott Makeig, Bhaskar D. Rao, Low Energy Wireless Body-Area Networks for Fetal ECG Telemonitoring via the Framework of Block Sparse Bayesian Learning, submitted to IEEE Trans. on Biomedical Engineering

We have an invited review paper on sparse Bayesian learning for structured signals. This paper reviewed our lab's work on SBL. We also hoped to include all the interesting SBL papers for structured signals. But since this is a short paper, we had to select limited papers.

Bhaskar D. Rao, Zhilin Zhang, Yuzhe Jin, Sparse Signal Recovery in the Presence of Intra-Vector and Inter-Vector Correlation, International Conference on Signal Processing and Communications (SPCOM 2012)

I (and my friend, Lei, together) was also invited to write a review paper on SBL for a Chinese journal. So, I posted my part in my homepage, which can be downloaded here: I hope this short review can give Chinese people a bird-eye on my work on SBL.

Finally, I was selected to attend the Doctoral Consortium of CVPR 2012. I will have a  poster to present all my work on SBL. I am eager to see you and receive your comments.