quora / qmf

A fast and scalable C++ library for implicit-feedback matrix factorization models
Apache License 2.0
462 stars 96 forks source link

performance of bpr #18

Open jackyhawk opened 6 years ago

jackyhawk commented 6 years ago

Hi all,

I just run bpr , and my input data is like this: 5 million users 680,000 items 5 billion clicks

and my machine is as the details at bottom.

and it would take me about 3.5 hours to train (convergence) with 20 epoch.

and is there any way to accelerate the speed of the training?

and my machine is like this:

lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.3.1611 (Core) Release: 7.3.1611 Codename: Core

cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l 2

cat /proc/cpuinfo| grep "cpu cores"| uniq cpu cores : 8

cat /proc/cpuinfo| grep "processor"| wc -l 32

Thanks very much

jackyhawk commented 6 years ago

Any suggestions for this? Thanks very much

jackyhawk commented 6 years ago

And would als be a lot fater that bpr?

Thanks very much

zenogantner commented 6 years ago

In my experience ALS is often faster. Just try it out!

jackyhawk commented 6 years ago

Thanks very much.

And I wonder why bpr is so slow?

zenogantner commented 6 years ago

There may be implementation details that contribute to it, but in general:

ALS (WRMF etc.) is linear in the number of observations and cubic in the number of factors (there may be better speed-ups nowadays). BPR is also linear in the number of observations and linear in the number of factors, but needs more epochs to converge.

jackyhawk commented 5 years ago

it seems that als is slower than bpr, with the same amount of data( 0.5 billion)

jackyhawk commented 5 years ago

it would take about 18 hours to train bpr and 40 hours to train als for about 0.5 billion training data