The text of DEMO program S.Funk

Generalized Matrix Factorization

There is no shortage of algorithms for matrix factorization, however, most of them do not provide support for hidden elements and for multiple elements in each matrix cell.

In general case we may not know all elements of the matrix and also have multiple elements for a particular cell. Let us look at the data below. It is sort of 3d matrix that has three approximately equal layers, so we have 3 elements for each row-column combination, but there are two row-column combinations, for which we do not have data at all. But we still want to find decomposition in a form of two matrices, that when multiplied produce some product close to each of these layers.

Layer 1
30N/A4011
30453311
30456420
2436N/A25
36547932
Layer 2
31N/A4112
32473614
31456422
2538N/A28
38567935
Layer 3
33N/A4111
33453411
30486521
2537N/A26
37568133

With suggested under link at the top algorithm we found cofactors and the product of them shown below.

Left cofactor
1.2494.0844.205
1.0062.7045.272
4.3044.8702.412
5.7002.5342.135
6.6763.3804.183
Right cofactor
1.4442.2937.8644.063
2.8304.4945.069-0.027
4.2815.9232.4111.514
Product
31.36346.12740.66611.331
31.67145.68334.32811.997
30.32046.03964.34521.002
24.53937.10162.81626.318
37.11055.27179.71533.362

The credit goes to someone under name S.Funk, who published this procedure several years ago for two dimensional matrices, and my role is reduced to generalization it into 3d matrices with approximately equal layers.

The impressive part of this algorithm is that (at the core) it needs only few lines of code.


Andrew Polar, Jan, 2017.