graphlab.recommender.ItemSimilarityModel.predict

User 650 | 8/30/2014, 11:49:55 AM

This is my first day using graphlab.

I am trying to use the predict attribute but I get the following error

AttributeError: 'ItemSimilarityModel' object has no attribute 'predict'

The code I am tring to run: sim = gl.recommender.create(data, method='itemsimilarity',similaritytype='cosine',threshold=0.0) b=gl.SFrame({'userid':["1034801"],'itemid':["114"]}) sim.predict(b)

what am I doing wrong?

Thanks

Comments

User 18 | 8/31/2014, 4:58:02 AM

Are you using version 0.9.1? The current documentation is for the latest version of GraphLab Create. In earlier versions, 'predict()' was called 'score()'. It was renamed to 'predict' in v0.9.1 to be consistent with the other toolkits.


User 650 | 9/2/2014, 5:51:17 AM

Thank you alice. That did the trick. Can I change the score/predict calculation? make a slight alteration? How do I get a list of all the items rated by the user?


User 19 | 9/2/2014, 6:00:33 AM

At the moment we do not allow customization of the predict() calculation for ItemSimilarityModel objects. Each of the similarity types (Jaccard, Cosine, and Pearson) have slightly different predict functions, so please consider the similarity type that you think is most appropriate for your application.

To get a list of all items rated by a user, you could filter the original SFrame (assuming that there is a 'user' column and an 'item' column):

<pre> sf['item'][sf['user'] == chosen_user] </pre>