CastellanZhang / lambdaFM

Multi-thread implementation of lambdaFM with FTRL for ranking problem. LambdaFM is a learning-to-rank algorithm by combining LambdaRank and Factorization Machines.
MIT License
111 stars 31 forks source link

ftrl_trainer : trainPair函数,一对sample,为什么相同名称的 feature 要覆盖掉呢? #14

Closed YELLOWH closed 2 years ago

YELLOWH commented 2 years ago

for(unordered_map<string, double>::iterator iter = sample1.x.begin(); iter != sample1.x.end(); ++iter) { const string& index = iter->first; if(theta.find(index) == theta.end()) { theta[index] = pModel->getOrInitModelUnit(index); } }

for(unordered_map<string, double>::iterator iter = sample2.x.begin(); iter != sample2.x.end(); ++iter) { const string& index = iter->first; if(theta.find(index) == theta.end()) { theta[index] = pModel->getOrInitModelUnit(index); } }

看了楼主博客的公式推导,还是不太明白,望楼主看到的话可以解答下,谢谢啦