Using the PALM4MSA-MHTP Algorithm

In this notebook we shall see how to use the PALM4MSA-MHTP algorithm. A notebook has already been written on the Hierarchical PALM4MSA algorithm and its wrappers and is a prerequisite to the reading of this notebook.

The PALM4MSA-MHTP is a variant of PALM4MSA in which intervenes the Multilinear Hard Tresholdhing Pursuit algorithm (MHTP).

The interest of this variant is to avoid the situation in which PALM4MSA tends to stuck on some matrix supports without any way out. MHTP allows to explore the support more freely and hopefully find a more accurate factorization at the cost of just a few more dozens iterations of the gradient descent algorithm.

For more information on the theory, you can read the following paper in which is treated the particular case of the BHTP (Bilinear HTP, that is running the MHTP on only two factors).

[1] Quoc-Tung Le, Rémi Gribonval. Structured Support Exploration For Multilayer Sparse Matrix Fac- torization. ICASSP 2021 - IEEE International Conference on Acoustics, Speech and Signal Processing, Jun 2021, Toronto, Ontario, Canada. pp.1-5. hal-03132013.

Configuring and Running PALM4MSA-MHTP

This variant works very similarly to a classic run of PALM4MSA, that is with at least the same set of parameters. The main difference is that periodically (in term of PALM4MSA number of iterations) the MHTP algorithm is launched to renew each layer of the Faust being refined.

Hence running the PALM4MSA-MHTP needs two sets of parameters: ParamsPalm4MSA and MHTPParams objects. The former should not be really new if you are used to PALM4MSA, the latter is dedicated to the configuartion of the MHTP part of PALM4MSA-MHTP.

The arguments to configure MHTPParams are basically:

So let's run PALM4MSA-MHTP on a small example: we propose to factorize a 500x32 matrix into two factors.

First we configure PALM4MSA as usual:
Second we define the MHTPParams structure to configure the MHTP pass of PALM4MSA-MHTP

Hence we define the arguments described above: num_its, etc. We let all of them to their default values so there is not much to do.

It's now time to run the PALM4MSA-MHTP algorithm passing the two structures of parameters. Before we generate a random matrix M to factorize.

As you see it's pretty similar to running PALM4MSA, which we could have done with the following code.

We can verify that the results are however not the same:

They are very close though! In the next part of this notebook we'll demonstrate how PALM4MSA-MHTP can really enhance the accuracy of the Faust approximate and will do that on the MEG matrix (this matrix is also discussed and factorized in [1]).

Factorizing the MEG matrix using the PALM4MSA-MHTP algorithm

The MEG (for magnetoencephalography) matrix is also used in [1] to compare PALM4MSA and PALM4MSA-MHTP performance.
The goal is to factorize the MEG matrix as $M_{MEG} \approx A \times B$ with $M_{MEG} \in \mathbb{R}^{8193 \times 204}, A \in \mathbb{R}^{8193 \times 204}$ and $B \in \mathbb{R}^{204 \times 204}$. A and B are subject to sparsity constraints. Here we'll test only one sparsity configuration of the two factors ($k_0$ = 100 and $k_1 = 25$ being respectively the per-row number of nonzeros of A and B).

Let's load the MEG matrix which is embedded in FAµST data package (which should be downloaded automatically).

Going ahead we set the PALM4MSA parameters:

It remains the MHTPParams configuration (it's easy, we use the default parameters) :

Now we are able to launch PALM4MSA and PALM4MSA-MHTP and compare the errors: the computation takes some time, it can last about 30 minutes.

As you see the MHTP variant is twice accurate than PALM4MSA on this configuration.

Using the Hierarchical PALM4MSA-MHTP algorithm

Exactly the same way you can use the hierarchical factorization with PALM4MSA, it is possible to use the function pyfaust.fact.hierachical_mhtp to run a hierarchical factorization based on PALM4MSA-MHTP instead of simply PALM4MSA.
The launch of the algorithm function is very similar, you just need to add a MHTPParams instance to the argument list.

Let's show how with this simple example:

This notebook is ending here. Please note that although the article [1] tackles the optimization problem of approximately factorizing a matrix in two sparse factors with the Bilinear Hard Tresholding Pursuit (BHTP) algorithm, the MHTP is a generalization to N factors that needs further experiences to be mature. Hence the function palm4msa_mhtp and moreover the function hierarchical_mhtp should be considered as experimental code and might evolve significantly in the future.

Thanks for reading this notebook! Many other are available at

Note: this notebook was executed using the following pyfaust version: