Reputation: 154
I want to train LightFM with Dataframe shown below.
FromUserID | Title | PostID | Views | Likes |
---|---|---|---|---|
1 | Cricket | 34 | 12 | 8 |
6 | Mobile | 37 | 11 | 6 |
3 | tv | 34 | 8 | 5 |
5 | WTC final | 30 | 6 | 5 |
I already trained the model with Views column (which is working fine) but also want to add Likes column. I have seen lot of examples, however I'm still not able to understand how to train model based on dataframe I have.
Below are the code snippets I tried so far,
x = actual_topreviews.pivot_table(index='FromUserID', columns='PostId', values='Views')
xNan = x.fillna(0)
interaction = sp.csr_matrix(xNan.values)
hybridModel = LightFM(loss='warp-kos')
hybridModel.fit(interaction, epochs=30)
user_x=3
n_users, n_items = interactions.shape
scores = pd.Series(model.predict(user_x, np.arange(n_items)))
How can I train the model with both Views and Likes column?
Any suggestions or code snippets to help my understanding would really be appreciated. thank you
Upvotes: 1
Views: 303