项目作者: YuyuZha0

项目描述 :
Click-Through Rate Estimation for Rare Events in Online Advertising
高级语言: Java
项目地址: git://github.com/YuyuZha0/bayes-smoothing.git
创建时间: 2017-05-11T07:28:15Z
项目社区:https://github.com/YuyuZha0/bayes-smoothing

开源协议:

下载


bayes-smoothing

Click-Through Rate Estimation for Rare Events in Online Advertising

This program implements the algorithm desribed in [http://www.cs.cmu.edu/~xuerui/papers/ctr.pdf]

The fixed-pointed-iteration was accelerated by Steffensen method [https://en.wikipedia.org/wiki/Steffensen%27s_method].
Steffensen method

Usage:

  1. final BayesSmoothingExecutor executor = new BayesSmoothingExecutor(1e-7, 100000);
  2. System.out.println("start generating bayes smoothing...");
  3. long t1 = System.currentTimeMillis();
  4. final List<BayesSmoothingResult> resultList = recordList
  5. .stream()
  6. .collect(Collectors.groupingBy(CreativeAdUnitRecord::getAdUnitId, Collectors.toList()))
  7. .entrySet()
  8. .stream()
  9. .parallel()
  10. .map(entry -> {
  11. final List<RecordEntry> samples = entry.getValue()
  12. .stream()
  13. //同一广告位下的样本按照创意ID进行聚合
  14. .collect(Collectors.groupingBy(
  15. CreativeAdUnitRecord::getCreativeId,
  16. Collectors.mapping(CreativeAdUnitRecord::getEntry,
  17. Collectors.reducing(RecordEntry.of(), RecordEntry::merge))
  18. ))
  19. .entrySet()
  20. .stream()
  21. .map(Map.Entry::getValue)
  22. //对样本进行过滤
  23. .filter(re -> {
  24. long clickCount = re.getClickCount();
  25. long impressionCount = re.getImpressionCount();
  26. return clickCount > 5 && impressionCount > 10000 && clickCount < impressionCount;
  27. })
  28. .collect(Collectors.toList());
  29. return new AbstractMap.SimpleEntry<>(entry.getKey(), samples);
  30. })
  31. .filter(entry -> entry.getValue().size() > 3)
  32. .map(entry -> executor.executeSmoothing(entry.getKey(), entry.getValue()))
  33. .collect(Collectors.toList());
  34. long t2 = System.currentTimeMillis();