JohnLangford/vowpal_wabbit — pull request #245 by jhofman (2014-02-24 22:06:10+00:00)
Title: gd_mf_weights to dump matrix factorization model

added some code to dump a readable version of the gd_mf matrix factorization model to disk.

usage is similar to recommend.cc, where you provide a vw parameter string to load up a model and give examples as input, best explained by an example.

to extract weights for user 42 and item 7 under a (randomly initialized) rank 10 model:
echo '|u 42 |i 7' | ./gd_mf_weights -I /dev/stdin --vwparams '-q ui --rank 10'

presumably you have a model to load, so the param string would include -i model.reg, etc., in the vwparams.

five files will be written out:

constant: a float for the global constant
/.linear: featureweight
/.quadratic: featurerank1 weightrank2 weight...rankK weight
/.linear: featureweight
/.quadratic: featurerank1 weightrank2 weight...rankK weight

in the example above, this results in constant, u.linear, u.quadratic, i.linear, i.quadratic files.