vowpal wabbit中的零线性回归模型

时间:2017-04-19 19:12:55

标签: vowpalwabbit

我想使用null模型对vowpal wabbit进行线性回归(仅限拦截 - 出于比较原因)。我应该使用哪种优化器?同样是简单平均值报告的最佳恒定损失?

1 个答案:

答案 0 :(得分:1)

A1:对于线性回归,如果您关心平均值,则应使用--loss_function squared(这是默认值)。如果您更关心中位数而不是平均值(例如,如果您有一些可能会使平均值大大增加的异常值),请使用--loss_function quantile。顺便说一句:这些不是优化者,只是损失函数。我会保留优化器(增强型SGD)(默认值),因为它运行良好。

A2:best constant是可以提供最低错误的常量预测,best constant loss是始终预测best constant个数字的平均误差。它是所有目标变量的加权平均值。这与线性回归公式b中的截距y = Ai*xi + B不同。 B是免费术语,与输入无关。 B不一定是y的平均值。

A3:如果要查找模型的截距,请在模型中查找名为Constant的权重。这需要两个简短的步骤:

# 1) Train your model from the dataset
#    and save the model in human-readable (aka "inverted hash") format
vw --invert_hash model.ih your_dataset

# 2) Search for the free/intercept term in the readable model 
grep '^Constant:' model.ih

grep步骤的输出应该是:

Constant:116060:-1.085126

其中116060是哈希槽(模型中的位置),-1.085126是截距的值(假设没有哈希冲突,并且输入的线性组合。)