user2093930
user2093930

Reputation:

How to use a Vowpal Wabbit model outside of python

I have a question about how to use values generated by VW outside of python. For example, I have the following "readable output" from VW:

Feature1:221152:-0.0342143
Feature2:115611:-0.003415
Feature3:230533:-0.0162561
Feature4:222340:-0.0244261
Constant:116060:-0.74116
Feature5:240651:0.0662623
Feature6:201380:0.568669
Feature7:168515:0.00426367
Feature8:107643:-0.00488802
Feature9:25461:0.0186098
Feature10:172852:-0.00895446

If I have the following data point:

1 1 'datapoint1 | Feature10:0 Feature5:0 Feature3:0 Feature7:22 Feature4:7 Feature6:0.603153898117 Feature2:0 Feature1:0 Feature8:0 Feature9:0

That gives me the following results when I test through VW:

0.383351 datapoint1

But when I try to recreate that final value manually, I get a much different result:

-0.74116+(0.00426367*22)+(-0.0244261*7)+(0.568669*0.603153898117) = -0.475347035911703727
Constant    Feature7        Feature4          Feature6          

I am using a logistic loss function. Does anyone have any idea how we are supposed to use the values that VW generates outside of the VW framework? I am at a loss of how these generated values are supposed to be applied.

Upvotes: 0

Views: 188

Answers (1)

greeness
greeness

Reputation: 16104

If you apply a logistic transform to your result (because you used logistic regression)

f(y) = 1/(1+e(-y)) = 1/(1+exp(-(-0.475347))) = 0.38335

you get the same result as you see in VW.

Upvotes: 1

Related Questions