Search code examples
matrixmachine-learningartificial-intelligencefactorization

matrix elements prediction based on other matrices


Maybe here it is not a right place to make my question.

Anyway, I have the following matrices which A and B are sparse and C has no elements. how i can predict the entries in matrix C, regarding to matrices A and B?enter image description here


Solution

  • Assuming you have some kind of similarities in all matrices. Then, you have similarities between books, which are based on co-occurrence of keywords and also on similarity between different keywords:

    A = B C B^T.
    

    Where A is your similarity matrix, B is matrix of keywords corresponding to books and C is a matrix of similarities between different keywords.

    You have A matrix of size n_A, and rank no more than n_A. Then you can only recover C up to the same rank n_A, so you can assume C to have form

    C = V^T V.
    

    Then, you can easily restore C, by doing eigendecomposition of A. On one hand, you have

    A = U D U^T,
    

    on the other hand, you have

    A = B^T C B.
    

    Comparing those two, you have

    B V^T = U D^{1/2}, 
    

    because D is diagonal (hopefully A don't have complex eigenvalues, though).

    The equation above could be solved for V with minimum squares.

    All those solvers you need for this are implemented in all major programming languages, for example, in python it is numpy library.