{
  "id": 23227,
  "title": "Vowpal wabbit format",
  "url": "/competitions/bosch-production-line-performance/discussion/23227",
  "author_name": "",
  "post_date": "2016-08-31T17:59:22.533Z",
  "votes": null,
  "comment_count": 5,
  "views": 809,
  "content": "<p>Hi,\nI'm trying to make predictions based on numeric train set with vowpal wabbit, however I dont know how to format lines for vowpal.</p>\n\n<p>Can I just divide label and features with &quot;|&quot; and features with space, like:\n<code>1 | 0.1 0.2 0.89</code> ...?</p>\n\n<p>How should string for predictions look?\nCan I just print features divided with space, like:\n<code>0.3 0.42 0.13 0.13</code> ...?</p>\n\n<p>I read vw docs but it's not clear for me.</p>",
  "messages": [
    {
      "id": "133160",
      "postDate": "08/31/2016 17:59:22",
      "content": "<p>Hi,\nI'm trying to make predictions based on numeric train set with vowpal wabbit, however I dont know how to format lines for vowpal.</p>\n\n<p>Can I just divide label and features with &quot;|&quot; and features with space, like:\n<code>1 | 0.1 0.2 0.89</code> ...?</p>\n\n<p>How should string for predictions look?\nCan I just print features divided with space, like:\n<code>0.3 0.42 0.13 0.13</code> ...?</p>\n\n<p>I read vw docs but it's not clear for me.</p>",
      "rawMarkdown": "Hi,\r\nI'm trying to make predictions based on numeric train set with vowpal wabbit, however I dont know how to format lines for vowpal.\r\n\r\nCan I just divide label and features with \"|\" and features with space, like:\r\n`1 | 0.1 0.2 0.89` ...?\r\n\r\nHow should string for predictions look?\r\nCan I just print features divided with space, like:\r\n`0.3 0.42 0.13 0.13` ...?\r\n\r\nI read vw docs but it's not clear for me.",
      "votes": null
    },
    {
      "id": "133175",
      "postDate": "08/31/2016 19:56:30",
      "content": "<p>I suggest you try this one: </p>\n\n<p><a href=\"https://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format\">https://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format</a></p>\n\n<p>and then the fastml.com blog:</p>\n\n<p><a href=\"http://fastml.com/blog/categories/vw/\">http://fastml.com/blog/categories/vw/</a></p>\n\n<p>Most of the posts in the latter link to code examples in github.</p>",
      "rawMarkdown": "I suggest you try this one: \r\n\r\nhttps://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format\r\n\r\nand then the fastml.com blog:\r\n\r\nhttp://fastml.com/blog/categories/vw/\r\n\r\nMost of the posts in the latter link to code examples in github.",
      "votes": null
    },
    {
      "id": "133192",
      "postDate": "08/31/2016 21:31:41",
      "content": "<p>I read vw tutorial, but there is nothing about prediction arguments.\nSecond link is interesting.\nThank you Konrad! :)</p>",
      "rawMarkdown": "I read vw tutorial, but there is nothing about prediction arguments.\r\nSecond link is interesting.\r\nThank you Konrad! :)",
      "votes": null
    },
    {
      "id": "133385",
      "postDate": "09/01/2016 19:46:04",
      "content": "<p>You need a feature name before the value in libSVM format.</p>\n\n<p>To use your example:</p>\n\n<pre><code> 1 | a:0.1 b:0.2 zoo:0.89\n</code></pre>\n\n<p>1 is the target feature, so it doesn't need a name, but the (numeric) input features need it.\nIn this example:  there are 3 features:  a  b  zoo\nwith values:  0.1  0.2  0.89   respectively.</p>\n\n<p>This answer on SO has the cheat-sheet for feature representation in vw:</p>\n\n<p><a href=\"https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968\">https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968</a></p>",
      "rawMarkdown": "You need a feature name before the value in libSVM format.\r\n\r\nTo use your example:\r\n\r\n     1 | a:0.1 b:0.2 zoo:0.89\r\n\r\n1 is the target feature, so it doesn't need a name, but the (numeric) input features need it.\r\nIn this example:  there are 3 features:  a  b  zoo\r\nwith values:  0.1  0.2  0.89   respectively.\r\n\r\nThis answer on SO has the cheat-sheet for feature representation in vw:\r\n\r\n https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968",
      "votes": null
    },
    {
      "id": "133431",
      "postDate": "09/02/2016 06:14:38",
      "content": "<p>A function in the given code might help you to convert csv to VW format\n<a href=\"https://github.com/hiransuvrat/machinelearning/blob/master/utilities.py\">https://github.com/hiransuvrat/machinelearning/blob/master/utilities.py</a></p>\n\n<p>Note: This was written couple of years back. You might have to struggle a bit to understand all parameters</p>",
      "rawMarkdown": "A function in the given code might help you to convert csv to VW format\r\nhttps://github.com/hiransuvrat/machinelearning/blob/master/utilities.py\r\n\r\nNote: This was written couple of years back. You might have to struggle a bit to understand all parameters",
      "votes": null
    },
    {
      "id": "134058",
      "postDate": "09/04/2016 21:48:41",
      "content": "<p>There is a utility in vw called &quot;csv2vw&quot; in the /utl/ folder</p>\n\n<p>Run it like this:</p>\n\n<pre><code>perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw -h -- -1 train.csv &gt; trn_vw.txt\n</code></pre>\n\n<p>this would take your &quot;train.csv&quot; file and output a vw format filw as &quot;trn_vw.txt&quot;</p>\n\n<p>-h means it has a header</p>\n\n<p>-- means no more arugements becuase you are are about to use:</p>\n\n<p>-1 means use the last column as your label</p>\n\n<p>if you run</p>\n\n<pre><code>perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw \n</code></pre>\n\n<p>A nice helpscreen apears with all the options.  That should get you started.  a nice hidden gem from the vw team that helps with really big files like these.</p>",
      "rawMarkdown": "There is a utility in vw called \"csv2vw\" in the /utl/ folder\r\n\r\nRun it like this:\r\n\r\n    perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw -h -- -1 train.csv > trn_vw.txt\r\n\r\nthis would take your \"train.csv\" file and output a vw format filw as \"trn_vw.txt\"\r\n\r\n-h means it has a header\r\n\r\n-- means no more arugements becuase you are are about to use:\r\n\r\n-1 means use the last column as your label\r\n\r\nif you run\r\n\r\n    perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw \r\n\r\nA nice helpscreen apears with all the options.  That should get you started.  a nice hidden gem from the vw team that helps with really big files like these.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 133175,
      "author_name": "konradb",
      "author_url": "",
      "post_date": "08/31/2016 19:56:30",
      "content": "<p>I suggest you try this one: </p>\n\n<p><a href=\"https://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format\">https://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format</a></p>\n\n<p>and then the fastml.com blog:</p>\n\n<p><a href=\"http://fastml.com/blog/categories/vw/\">http://fastml.com/blog/categories/vw/</a></p>\n\n<p>Most of the posts in the latter link to code examples in github.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 133192,
      "author_name": "tomkowski",
      "author_url": "",
      "post_date": "08/31/2016 21:31:41",
      "content": "<p>I read vw tutorial, but there is nothing about prediction arguments.\nSecond link is interesting.\nThank you Konrad! :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 133385,
      "author_name": "sojourner",
      "author_url": "",
      "post_date": "09/01/2016 19:46:04",
      "content": "<p>You need a feature name before the value in libSVM format.</p>\n\n<p>To use your example:</p>\n\n<pre><code> 1 | a:0.1 b:0.2 zoo:0.89\n</code></pre>\n\n<p>1 is the target feature, so it doesn't need a name, but the (numeric) input features need it.\nIn this example:  there are 3 features:  a  b  zoo\nwith values:  0.1  0.2  0.89   respectively.</p>\n\n<p>This answer on SO has the cheat-sheet for feature representation in vw:</p>\n\n<p><a href=\"https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968\">https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 133431,
      "author_name": "suvrathiran",
      "author_url": "",
      "post_date": "09/02/2016 06:14:38",
      "content": "<p>A function in the given code might help you to convert csv to VW format\n<a href=\"https://github.com/hiransuvrat/machinelearning/blob/master/utilities.py\">https://github.com/hiransuvrat/machinelearning/blob/master/utilities.py</a></p>\n\n<p>Note: This was written couple of years back. You might have to struggle a bit to understand all parameters</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 134058,
      "author_name": "rdslater",
      "author_url": "",
      "post_date": "09/04/2016 21:48:41",
      "content": "<p>There is a utility in vw called &quot;csv2vw&quot; in the /utl/ folder</p>\n\n<p>Run it like this:</p>\n\n<pre><code>perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw -h -- -1 train.csv &gt; trn_vw.txt\n</code></pre>\n\n<p>this would take your &quot;train.csv&quot; file and output a vw format filw as &quot;trn_vw.txt&quot;</p>\n\n<p>-h means it has a header</p>\n\n<p>-- means no more arugements becuase you are are about to use:</p>\n\n<p>-1 means use the last column as your label</p>\n\n<p>if you run</p>\n\n<pre><code>perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw \n</code></pre>\n\n<p>A nice helpscreen apears with all the options.  That should get you started.  a nice hidden gem from the vw team that helps with really big files like these.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "133160": "Hi,\r\nI'm trying to make predictions based on numeric train set with vowpal wabbit, however I dont know how to format lines for vowpal.\r\n\r\nCan I just divide label and features with \"|\" and features with space, like:\r\n`1 | 0.1 0.2 0.89` ...?\r\n\r\nHow should string for predictions look?\r\nCan I just print features divided with space, like:\r\n`0.3 0.42 0.13 0.13` ...?\r\n\r\nI read vw docs but it's not clear for me.",
    "133175": "I suggest you try this one: \r\n\r\nhttps://github.com/JohnLangford/vowpal_wabbit/wiki/Input-format\r\n\r\nand then the fastml.com blog:\r\n\r\nhttp://fastml.com/blog/categories/vw/\r\n\r\nMost of the posts in the latter link to code examples in github.",
    "133192": "I read vw tutorial, but there is nothing about prediction arguments.\r\nSecond link is interesting.\r\nThank you Konrad! :)",
    "133385": "You need a feature name before the value in libSVM format.\r\n\r\nTo use your example:\r\n\r\n     1 | a:0.1 b:0.2 zoo:0.89\r\n\r\n1 is the target feature, so it doesn't need a name, but the (numeric) input features need it.\r\nIn this example:  there are 3 features:  a  b  zoo\r\nwith values:  0.1  0.2  0.89   respectively.\r\n\r\nThis answer on SO has the cheat-sheet for feature representation in vw:\r\n\r\n https://stackoverflow.com/questions/28640837/vowpal-wabbit-how-to-represent-categorical-features/28643968#28643968",
    "133431": "A function in the given code might help you to convert csv to VW format\r\nhttps://github.com/hiransuvrat/machinelearning/blob/master/utilities.py\r\n\r\nNote: This was written couple of years back. You might have to struggle a bit to understand all parameters",
    "134058": "There is a utility in vw called \"csv2vw\" in the /utl/ folder\r\n\r\nRun it like this:\r\n\r\n    perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw -h -- -1 train.csv > trn_vw.txt\r\n\r\nthis would take your \"train.csv\" file and output a vw format filw as \"trn_vw.txt\"\r\n\r\n-h means it has a header\r\n\r\n-- means no more arugements becuase you are are about to use:\r\n\r\n-1 means use the last column as your label\r\n\r\nif you run\r\n\r\n    perl  /location_of_vw/vowpal_wabbit-8.1.1/utl/csv2vw \r\n\r\nA nice helpscreen apears with all the options.  That should get you started.  a nice hidden gem from the vw team that helps with really big files like these."
  },
  "source": "meta"
}