Building a item-item matrix in java
I am building a item-item matrix and have the data in the following format
UserX item1,item2,item3
userY item4,item5,item6
.....
i need to build matrix of the form
item1 item2 item3
item1
item2
item3
What would be the best design and data structu开发者_如何学Pythonre to go about as i will be handling large amounts of data?
Currently i have been designing using Hashmaps. Is there any other better solution?
EDIT : The matrix will be used to store the association value of item1 to item 2,item3.... The end use would be to build something similar to Amazon recommendations.
The data structure that sprung to mind when I read your "matrix" requirement was Guava's Table. I don't know if it's the most performant one (HashBasedTable, the "standard" implementation, uses hash tables), but it seems to be the easiest to manipulate for what you want to do (cleaner code).
That being said, I think you should look at real recommendation engines. In Java, you could look at Apache Mahout Taste. You could also use Google's prediction API.
精彩评论