Closed zwhe99 closed 4 years ago
I found that removing the "if self .__ matrix is None:" of the GraphModality.matrix can solve this error. This resulted in user_graph.matrix not being updated correctly in the next fold.
Thanks for pointing out this issue. Indeed, the matrix is not being updated correctly across folds. Ignoring the "if self .__ matrix is None:" statement fixes the problem. However, this is not an efficient solution, as the matrix will be build at every call. We are working on a more efficient solution. Meanwhile, we suggest removing the if statement or using RatioSplit instead.
Thank you!
Maybe you can construct the matrix at the end of GraphModality._build_triplet().
The problem with the adjacency matrix in the graph modality is now solved (PR 333), so I will close this issue.
Description
I try to add a recommender model with social network. And I need to access the 'trustees' for each 'trustor' in training set, so I code as follows:
Then an error occurred in the place shown in the comment:
I set a breakpoint at the location where the error occurred and found that the size of the train_set.user_graph.matrix is smaller than train_set.num_users when the error occurred.
I don't know if my code is wrong or a bug in Cornac, but this error only appears in the last few folds of cross-validation, the first fold usually works correctly. So I think user_graph may not be updated correctly in the later fold.
In which platform does it happen?
OS: Windows 10 python:3.6 Cornac: 1.4.1
How do we replicate the issue?
Run the script below:
Expected behavior (i.e. solution)
If this is a bug, please fix it, if not, please tell me how to modify my code to achieve this purpose
Other Comments