Skip to content

Instantly share code, notes, and snippets.

@jfkirk
Created January 18, 2019 02:34
Show Gist options
  • Save jfkirk/f23d5c9415b1cc0628c71f19ee3c88dc to your computer and use it in GitHub Desktop.
Save jfkirk/f23d5c9415b1cc0628c71f19ee3c88dc to your computer and use it in GitHub Desktop.
# Let's try a new loss function: WMRB
print("Training collaborative filter with WMRB loss")
ranking_cf_model = tensorrec.TensorRec(n_components=5,
loss_graph=tensorrec.loss_graphs.WMRBLossGraph())
ranking_cf_model.fit(interactions=sparse_train_ratings_4plus,
user_features=user_indicator_features,
item_features=item_indicator_features,
n_sampled_items=int(n_items * .01))
# Check the results of the WMRB MF CF model
print("WMRB matrix factorization collaborative filter:")
predicted_ranks = ranking_cf_model.predict_rank(user_features=user_indicator_features,
item_features=item_indicator_features)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment