打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
libffm with ftrl updater

这个东西之前就听说过,在某些特定场景效果很好,

看到一个开源项目,所以把要点翻译了一些,同时实践了一下;

大部分内容与libffm相同

开源项目:

https://github.com/guestwalk/libffm

https://github.com/CNevd/libffm-ftrl

一个libffm的Python wapper https://github.com/turi-code/python-libffm


全名

Factorization Machines with Follow-The-Regularized-Leader


论文

Factorization Machines with Follow-The-Regularized-Leader for CTR prediction in Display Advertising]

http://www0.cs.ucl.ac.uk/staff/w.zhang/rtb-papers/fm-ftrl.pdf

libFFM 本身用的是SGD, 参考http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf


FFM
比较容易过拟合,目前的处理方法是early stopping

一个例子:

> ffm-train -p va.ffm -l 0.00002 tr.ffm iter tr_logloss va_logloss 1 0.49738 0.48776 2 0.47383 0.47995 3 0.46366 0.47480 4 0.45561 0.47231 5 0.44810 0.47034 6 0.44037 0.47003 7 0.43239 0.46952 8 0.42362 0.46999 9 0.41394 0.47088 10 0.40326 0.47228 11 0.39156 0.47435 12 0.37886 0.47683 13 0.36522 0.47975 14 0.35079 0.48321 15 0.33578 0.48703

可以看到第7轮 validation loss就达到最小了,接着训练就是过拟合了,

同时需要注意到加大正则参数是不管用的

> ffm-train -p va.ffm -l 0.0002 -t 50 -s 12 tr.ffm iter tr_logloss va_logloss 1 0.50532 0.49905 2 0.48782 0.49242 3 0.48136 0.48748 ... 29 0.42183 0.47014 ... 48 0.37071 0.47333 49 0.36767 0.47374 50 0.36472 0.47404

推荐的方法是用-p带验证集,同时使用--auto-stop

> ffm-train -p va.ffm -l 0.00002 --auto-stop tr.ffm iter tr_logloss va_logloss 1 0.49738 0.48776 2 0.47383 0.47995 3 0.46366 0.47480 4 0.45561 0.47231 5 0.44810 0.47034 6 0.44037 0.47003 7 0.43239 0.46952 8 0.42362 0.46999 Auto-stop. Use model at 7th iteration.



libffm数据格式:

<label> <field1>:<index1>:<value1> <field2>:<index2>:<value2> ...
其中field 和 index必须是非负整数


libffm和libffm-ftrl的主要区别是几个参数:

libffm的-l <lambda>: set regularization parameter (default 0.00002)

在libffm-ftrl中没有了,取代的是

    -L1 <L1>: set L1 regularization parameter (default 0.)
    -L2 <L2>: set L2 regularization parameter (default 0.)
    -alpha <alpha>: set Per-Coordinate Learning Rate alpha (default 0.3)
    -beta <beta>: set Per-Coordinate Learning Rate beta (default 1.0)


反映到源代码中就是ffm_parameter结构体

libffm:

variable         meaning                             default
    ============================================================
。。。
    lambda           regularization cost                       0

libffm-ftrl:

    variable         meaning                             default
    ============================================================
    alpha            Per-Coordinate Learning Rate            0.3
    beta             Per-Coordinate Learning Rate            1.0
    L1               L1 regularization cost                    0
    L2               L2 regularization cost                    0

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
一文读懂FM算法优势,并用python实现!(附代码)
FTRL算法理解
深度学习——深度神经网络的正则化
Stanford机器学习笔记-3.Bayesian statistics and Regulariz...
Oracle 并行相关的初始化参数
loadrunner 参数化
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服