Skip to content
Markus Cozowicz edited this page Jan 29, 2016 · 17 revisions

Disclaimer: for now it's C# only

The following JSON format can be ingested into VW:

  • Top-level properties are considered features for the default namespace.
  • Top-level non-features are considered namespaces.
  • Features are JSON strings, integer, float, boolean, arrays of integers and/or floats.
  • Top-level properties starting with _ are ignored, except if they match a special property (e.g. "_label").
  • Labels can be passed using top-level "_label" property.
  • If the JSON value is either a string, integer or float is converted to a string and passed directly to VW label parser.
  • If the JSON value is an object, the first property needs to match one of the JSON properties of SimpleLabel or ContextualBanditLabel.

The C# layer can ingest

  • JSON strings
  • JSON.NET's JsonReader
  • C# objects serializable to the above JSON format using JSON.NET serializing rules. Thus JsonProperty annotations are inspected and so on. This is particularly useful if one needs to score a given object, then serialize it JSON and train from the JSON serialization as it circumvents the de-serialization for the scoring part.

Examples

JSON VW String
 {"f1":25,"f2":true,"_aux":"some ignored info"} 
 | f1:25 f2
 {"ns1":{"location":"New York"},"f2":[1,0.2,3]} 
 |ns1 New_York | :1 :.2 :.3
 {"ns1":{"location":"New York"},"ns2":{"f2":3.4},"_label":1} 
1 |ns1 New_York |ns2 f2:3.4
 {"ns1":{"location":"New York", "f2":3.4},"_label":{"Label":2,"Weight":0.3}} 
2 0.3 |ns1 New_York f2:3.4
Clone this wiki locally