funk-svd
funk-svd copied to clipboard
Including method SVD.get_utility_matrix
A function to get the utility matrix with users as rows and items as columns was added to the SVD class. This matrix may be useful for other matrix factorization methods. A test for the function was developed in the run_experiment.py script.
Hi @guedes-joaofelipe! Glad to see you interest with this PR :)
Usually the utility matrix is so large and sparse that we don't want to store it in its plain form to avoid memory issues. What are your use cases that would benefit from it?
Also, I'm not sure this logic would belong to the SVD class, it's more about preprocessing (which is not required by the SVD)
Hey @gbolmier!
Usually, I use the matrix form when I want to use the predictions from SVD together with another model (making a hybrid, for example). I'm currently using this form to train a MAB recommender.
But I guess the matrix form could be inserted outside the class. I just made this PR in case anyone would be interested in this function. Do you think it would be better if the function was contained in the utils.py script? (if it should be contained at all in any script)
If I understand well, you need this format for compatible issues with your other models. It's not really efficient in most recommendation settings to use that format, are you using a library requiring it?
Usually the utility matrix is so large and sparse that we don't want to store it in its plain form to avoid memory issues. What are your use cases that would benefit from it?
FYI Pandas handle sparse data very well with low memory footprint: https://pandas.pydata.org/docs/user_guide/sparse.html#sparse-data-structures