2016-07-08 12 views
0

私はvowpal wabbitを使ってテキストに基づいて編集記事をトピックカテゴリ別に分類するために1対多のロジスティック回帰を試みています。トレーニングに使用したのと同じデータを使って新しい記事の予測をしようとすると、結果は悪くなりますが、オーバーフィットのために非現実的に良い結果が期待されます。この場合、私は実際にを欲しがっています。私はvowpal wabbitを正しく使用していることを確認したいからです。Vowpal Wabbitを使った1対多のロジスティック回帰分類器

私のモデルでは、各機能が記事からの言葉であり、各ラベルは、スポーツやエンターテイメントなど、カテゴリの識別子であり、このように見えるの例で訓練されている: 1 | the baseball player ... stadium 4 | musicians played all ... crowd ... 2 | fish are an ... squid

マイトレーニングコマンドは次のようになります。私は--probabilities--link=logistic Bを使用してい 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

vw --oaa=19 --loss_function=logistic --save_resume -d /tmp/train.vw -f /tmp/model.vw

私のテストコマンドは次のようになります私の結果は、そのクラスに属するその記事の確率として解釈可能にしたい。

私のデータセット(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 
+0

'--probabilities'では、' --link = logistic'や '--raw_predictions'は必要ありません。あなたのトレーニングデータはシャッフルされていますか(または自然順に並べられていますか? –

+0

@MartinPopel私は、ありがとう、参照してください。私は正確に '--probabilities'と' --link = logistic'が何をするかについての情報を見つけるのが難しいです。はい、私はトレーニングの前に私の例をシャッフルするように気をつけました。 (お返事ありがとうございました) – vaerek

+0

'--link = logisitic'なしで試しましたか? '--probabilities'は、内部的にロジスティックリンク関数を計算します。また、 '--save_resume'を省略してください。これは、モデルをより多くのステップで訓練する必要がある場合にのみ必要です(最後の訓練ステップで使用された場合、報告されたテストロスに影響を及ぼす可能性があります)。 –

答えて

0

私は私の主な問題は、私はより多くのパスを実行するために必要なだけのことだったと思います。私はvwがオンライン学習をどのように実装しているのか、バッチ学習とはどのように違うのかをよく理解していませんが、複数のパスを実行した後、平均損失は13%に減少しました。 --holdout_offを有効にすると、この損失は%1にさらに低下しました。 @arielfと@MartinPopelに感謝します。

Running training command with 2421 examples: vw --oaa=19 --loss_function=logistic --save_resume -c --passes 10 -d /tmp/train.vw -f /tmp/model.vw 
final_regressor = /tmp/model.vw 
Num weight bits = 18 
learning rate = 0.5 
initial_t = 0 
power_t = 0.5 
decay_learning_rate = 1 
using cache_file = /tmp/train.vw.cache 
ignoring text input in favor of cache input 
num sources = 1 
average since   example  example current current current 
loss  last   counter   weight label predict features 
1.000000 1.000000   1   1.0  11  1  234 
1.000000 1.000000   2   2.0  6  11  651 
1.000000 1.000000   4   4.0  2  12  1157 
1.000000 1.000000   8   8.0  4  2  74 
1.000000 1.000000   16   16.0  12  15  171 
0.906250 0.812500   32   32.0  9  6  6 
0.750000 0.593750   64   64.0  15  19  348 
0.625000 0.500000   128   128.0  12  12  110 
0.566406 0.507812   256   256.0  12  5  176 
0.472656 0.378906   512   512.0  5  5  168 
0.362305 0.251953   1024   1024.0  16  8  274 
0.293457 0.224609   2048   2048.0  3  4  118 
0.224670 0.224670   4096   4096.0  8  8  850 h 
0.191419 0.158242   8192   8192.0  6  6  249 h 
0.164926 0.138462  16384  16384.0  3  4  154 h 

finished run 
number of examples per pass = 2179 
passes used = 10 
weighted example sum = 21790.000000 
weighted label sum = 0.000000 
average loss = 0.132231 h 
total feature number = 12925010 
関連する問題