测试Mahout的Logistic Regression (SGD)

来源:互联网 发布:java rpc c# 编辑:程序博客网 时间:2024/06/14 01:04

今天看了个blog后,测试了下Mahout的Logistic Regression (SGD), 具体讲解参考Mahout. 

进入MAHOUT_HOME

1. 训练模型

$ bin/mahout trainlogistic --passes 1 --rate 1 --lambda 0.5 --input donut.csv --features 21 --output donut.model --target color --categories 2 --predictors x y xx xy yy a b c --types n n


结果:

21color ~ -0.016*Intercept Term + -0.016*xy + -0.016*yy      Intercept Term -0.01559                  xy -0.01559                  yy -0.01559    0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000    -0.015590929     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000     0.000000000 13/06/04 12:40:43 INFO driver.MahoutDriver: Program took 2013 ms (Minutes: 0.03355)

2. 测试模型

$ bin/mahout runlogistic --input donut.csv  --model donut.model --auc --scores --confusion

结果:

"target","model-output","log-likelihood"0,0.496,-0.6852840,0.490,-0.6740550,0.491,-0.6751621,0.495,-0.7033611,0.493,-0.7062890,0.495,-0.6832750,0.496,-0.6852820,0.492,-0.6771911,0.494,-0.7042220,0.495,-0.6841070,0.496,-0.6847651,0.494,-0.7052090,0.491,-0.6752721,0.495,-0.7034380,0.496,-0.6851210,0.496,-0.6848860,0.490,-0.6725000,0.495,-0.6824450,0.496,-0.6848721,0.495,-0.7030700,0.490,-0.6725110,0.495,-0.6836430,0.492,-0.6776101,0.492,-0.7089150,0.496,-0.6847441,0.494,-0.7047660,0.492,-0.6774961,0.492,-0.7086790,0.496,-0.6852221,0.495,-0.7036040,0.492,-0.6778460,0.490,-0.6727020,0.492,-0.6769800,0.494,-0.6814501,0.495,-0.7028450,0.493,-0.6790490,0.496,-0.6842621,0.493,-0.7065641,0.495,-0.7040160,0.490,-0.672624AUC = 0.52confusion: [[27.0, 13.0], [0.0, 0.0]]entropy: [[-0.7, -0.4], [-0.7, -0.5]]13/06/04 12:45:04 INFO driver.MahoutDriver: Program took 203 ms (Minutes: 0.0033833333333333332)

参考:Mahout的Logistic Regression (SGD): https://cwiki.apache.org/MAHOUT/logistic-regression.html

http://jayatiatblogs.blogspot.hk/2013/05/running-mahouts-logistic-regression.html

原创粉丝点击