JohnLangford/vowpal_wabbit — pull request #143 by pierce1987 (2013-08-24 18:52:02+00:00)
Title: support invert_hash for multiclass problem

As aykutfirat suggested, invert_hash is extended for multi-class problems such as oaa. It did not work since for the k regressors features strings are the same, and only one is inserted to the map. Now the index is added to the string, so the k strings are different and can be inserted.

The original way of calculating index for constant feature (especially in multi-class problems) seems wrong so it is fixed. In this way "Constant" shows up for --audit in multi-class problems.

Now in the invert_hash file output

string:index:value

instead of

string:value.

The only drawback is the string gets longer, but it works for multi-class problems.