Created
November 14, 2016 12:51
-
-
Save montenegrodr/f69c9637182f3f1bf5356c2b5c9b002e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from vowpalwabbit import pyvw | |
def to_vw(clf, text, str_labels): | |
vw_example = str('{} |f {} '.format(str_labels, text)) | |
return clf.example(vw_example) | |
clf = vw = pyvw.vw( | |
loss_function='logistic', oaa=2, | |
link='logistic', raw_predictions='output.txt' | |
) | |
ex = to_vw(clf, 'I like vowpal wabbit. But not that much.', '1') | |
clf.learn(ex) | |
clf.predict(ex, labelType=pyvw.pylibvw.vw.lMulticlass) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment