From 16967fe9e33bf43fee66e63c1eef90ca445b635d Mon Sep 17 00:00:00 2001 From: Max Sperlich Date: Tue, 29 Apr 2014 18:10:06 -0400 Subject: [PATCH 1/3] Fixed typo in regnormal code --- toolkits/collaborative_filtering/als_tensor.cpp | 2 +- toolkits/collaborative_filtering/pmf.cpp | 2 +- toolkits/collaborative_filtering/sparse_als.cpp | 2 +- toolkits/collaborative_filtering/wals.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkits/collaborative_filtering/als_tensor.cpp b/toolkits/collaborative_filtering/als_tensor.cpp index 6262f2ea..44f9822e 100644 --- a/toolkits/collaborative_filtering/als_tensor.cpp +++ b/toolkits/collaborative_filtering/als_tensor.cpp @@ -134,7 +134,7 @@ struct ALSVerticesInMemProgram : public GraphChiProgram Date: Mon, 5 May 2014 11:30:33 -0400 Subject: [PATCH 2/3] LibFM: fixed typo in load last_item_bias code last_item_bias file is saved with .mm extension, but loaded with .m --- toolkits/collaborative_filtering/libfm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkits/collaborative_filtering/libfm.cpp b/toolkits/collaborative_filtering/libfm.cpp index 0aaa5408..f3757827 100644 --- a/toolkits/collaborative_filtering/libfm.cpp +++ b/toolkits/collaborative_filtering/libfm.cpp @@ -314,7 +314,7 @@ int main(int argc, const char ** argv) { vec user_bias = load_matrix_market_vector(training +"_U_bias.mm", false, true); vec item_bias = load_matrix_market_vector(training +"_V_bias.mm", false, true); vec time_bias = load_matrix_market_vector(training+ "_T_bias.mm", false, true); - vec last_item_bias = load_matrix_market_vector(training+"_L_bias.m", false, true); + vec last_item_bias = load_matrix_market_vector(training+"_L_bias.mm", false, true); for (uint i=0; i Date: Wed, 14 May 2014 16:52:38 -0400 Subject: [PATCH 3/3] ALS/WALS: use rankUpdate() to update XtX This optimized calculation gives around a 2X speedup on the small netflix set in my testing (D=20) --- toolkits/collaborative_filtering/als.cpp | 2 +- toolkits/collaborative_filtering/wals.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkits/collaborative_filtering/als.cpp b/toolkits/collaborative_filtering/als.cpp index ff9de205..5c791ffd 100644 --- a/toolkits/collaborative_filtering/als.cpp +++ b/toolkits/collaborative_filtering/als.cpp @@ -131,7 +131,7 @@ struct ALSVerticesInMemProgram : public GraphChiProgramget_data(); vertex_data & nbr_latent = latent_factors_inmem[vertex.edge(e)->vertex_id()]; Xty += nbr_latent.pvec * observation; - XtX.triangularView() += nbr_latent.pvec * nbr_latent.pvec.transpose(); + XtX.selfadjointView().rankUpdate(nbr_latent.pvec); if (compute_rmse) { double prediction; rmse_vec[omp_get_thread_num()] += als_predict(vdata, nbr_latent, observation, prediction); diff --git a/toolkits/collaborative_filtering/wals.cpp b/toolkits/collaborative_filtering/wals.cpp index 1cbae954..7d50af0a 100644 --- a/toolkits/collaborative_filtering/wals.cpp +++ b/toolkits/collaborative_filtering/wals.cpp @@ -119,7 +119,7 @@ struct WALSVerticesInMemProgram : public GraphChiProgramget_data(); vertex_data & nbr_latent = latent_factors_inmem[vertex.edge(e)->vertex_id()]; Xty += nbr_latent.pvec * edge.weight * edge.time; - XtX.triangularView() += nbr_latent.pvec * nbr_latent.pvec.transpose() * edge.time; + XtX.selfadjointView().rankUpdate(nbr_latent.pvec, edge.time); if (compute_rmse) { double prediction; rmse_vec[omp_get_thread_num()] += wals_predict(vdata, nbr_latent, edge.weight, prediction) * edge.time;