我正在尝试一个反对所有逻辑回归分类编辑文章的主题类别根据他们的文本使用vowpal wabbit。当我尝试使用用于培训的相同数据对新文章进行预测时,结果很差,但由于过度拟合,我期望得到不切实际的好结果。在这种情况下,我实际上想要过度拟合,因为我想验证我是否正确使用了vowpal wabbit。一对一逻辑回归分类器与Vowpal Wabbit
我的模型被训练上的例子看起来像这样的,其中每个功能是从文章一个字,每一个标签是一个类别的标识符,如体育或娱乐: 1 | the baseball player ... stadium 4 | musicians played all ... crowd ... 2 | fish are an ... squid
我的训练命令如下: vw --oaa=19 --loss_function=logistic --save_resume -d /tmp/train.vw -f /tmp/model.vw
我的测试命令如下: vw -t --probabilities --loss_function=logistic --link=logistic -d /tmp/test.vw -i /tmp/model.vw -p /tmp/predict.vw --raw_predictions=/tmp/predictions_raw.vw
我使用--probabilities
和--link=logistic
b因为我希望我的结果可以被解释为属于该类的那篇文章的概率。
我对于我的数据集的大小(81个示例和52000个特征)有一个明显的问题,但是我预计这会导致严重的过度拟合,因此对与训练数据相同的数据集做出的任何预测都会相当好。 我在做我的vowpal wabbit命令有问题吗?我对数据科学的理解是关闭的吗?
这里是从训练命令的输出:
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = /tmp/train.vw
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 1.000000 1 1.0 15 1 451
1.000000 1.000000 2 2.0 8 15 296
1.000000 1.000000 4 4.0 8 7 333
0.875000 0.750000 8 8.0 15 15 429
0.500000 0.125000 16 16.0 8 7 305
0.531250 0.562500 32 32.0 12 8 117
0.500000 0.468750 64 64.0 3 15 117
finished run
number of examples per pass = 81
passes used = 1
weighted example sum = 81.000000
weighted label sum = 0.000000
average loss = 0.518519
total feature number = 52703
而对于测试命令:
only testing
predictions = /tmp/predict.vw
raw predictions = /tmp/predictions_raw.vw
Num weight bits = 18
learning rate = 0.5
initial_t = 0
power_t = 0.5
using no cache
Reading datafile = /tmp/test.vw
num sources = 1
average since example example current current current
loss last counter weight label predict features
1.000000 -0.015873 1 1.0 4294967295 3(7%) 117
1.000000 1.000000 2 2.0 4294967295 3(7%) 88
1.000000 1.000000 4 4.0 4294967295 3(7%) 188
1.000000 1.000000 8 8.0 4294967295 9(7%) 1175
1.000000 1.000000 16 16.0 4294967295 5(7%) 883
1.000000 1.000000 32 32.0 4294967295 7(7%) 229
1.000000 1.000000 64 64.0 4294967295 15(7%) 304
finished run
number of examples per pass = 40
passes used = 2
weighted example sum = 81.000000
weighted label sum = 0.000000
average loss = 1.000000
average multiclass log loss = 999.000000
total feature number = 52703
使用'--probabilities',您不需要'--link = logistic'和'--raw_predictions'。你的训练数据是否被洗牌(或按照自然顺序排列)? –
@MartinPopel我明白了,谢谢。我无法找到有关'--probabilities'和'--link = logistic'的信息。是的,在训练之前,我已经注意到我的例子。 (感谢实际上你的另一个SO回答) – vaerek
你没有试过它 - “link = logisitic'? '--probabilities'在内部计算逻辑链接函数。还可以尝试省略'--save_resume':只有在需要更多步骤训练模型时(如果在上一个训练步骤中使用它,可能会影响报告的测试损失),才需要使用它。 –