{
  "id": 23830,
  "title": "Vowpal Wabbit",
  "url": "/competitions/bosch-production-line-performance/discussion/23830",
  "author_name": "",
  "post_date": "2016-09-21T21:21:39.357Z",
  "votes": null,
  "comment_count": 5,
  "views": 794,
  "content": "<p>Has anyone have any progress with vowpal wabbit? Logistic function with default parameters results in 0.12411 on the private board. I'm having trouble improving it. I'm also using weighted importance to deal with the class imbalance problem. </p>",
  "messages": [
    {
      "id": "136422",
      "postDate": "09/21/2016 21:21:39",
      "content": "<p>Has anyone have any progress with vowpal wabbit? Logistic function with default parameters results in 0.12411 on the private board. I'm having trouble improving it. I'm also using weighted importance to deal with the class imbalance problem. </p>",
      "rawMarkdown": "Has anyone have any progress with vowpal wabbit? Logistic function with default parameters results in 0.12411 on the private board. I'm having trouble improving it. I'm also using weighted importance to deal with the class imbalance problem.",
      "votes": null
    },
    {
      "id": "136425",
      "postDate": "09/21/2016 21:47:29",
      "content": "<p>VW should be fine on the categorical stuff, however, the categorical stuff seems to be relatively uninformative.     </p>\n\n<p>As for the numeric data, I suspect that the relationship between those numbers and the target is non-monotonic. In particular, for manufacturing defects, I would expect that extreme values (either high or low) of measurements are associated with defects. VW learns a linear model, so if you train it on the raw features, it will struggle with non-monotonic relationships. You may be able to use VW, but you probably need additional feature engineering.</p>",
      "rawMarkdown": "VW should be fine on the categorical stuff, however, the categorical stuff seems to be relatively uninformative.     \r\n\r\nAs for the numeric data, I suspect that the relationship between those numbers and the target is non-monotonic. In particular, for manufacturing defects, I would expect that extreme values (either high or low) of measurements are associated with defects. VW learns a linear model, so if you train it on the raw features, it will struggle with non-monotonic relationships. You may be able to use VW, but you probably need additional feature engineering.",
      "votes": null
    },
    {
      "id": "136428",
      "postDate": "09/21/2016 21:54:42",
      "content": "<p>I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.</p>\n\n<p>On selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was &quot;unusual&quot; and represents a SWAG.  (I am a data science scrub).</p>",
      "rawMarkdown": "I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.\r\n\r\nOn selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was \"unusual\" and represents a SWAG.  (I am a data science scrub).",
      "votes": null
    },
    {
      "id": "136429",
      "postDate": "09/21/2016 21:55:43",
      "content": "<p>Thanks for the advice.  I'll try that. </p>",
      "rawMarkdown": "Thanks for the advice.  I'll try that.",
      "votes": null
    },
    {
      "id": "136480",
      "postDate": "09/22/2016 09:51:10",
      "content": "<p>@Bob you said : &quot;I took the avg/min/max/nacount of each station (numeric only)&quot;. If you did it for each station then Can you please tel me how did you append these features in the raw data.  </p>\n\n<p>[quote=Bob, Lord of Cats;136428]</p>\n\n<p>I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.</p>\n\n<p>On selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was &quot;unusual&quot; and represents a SWAG.  (I am a data science scrub).</p>\n\n<p>[/quote]</p>",
      "rawMarkdown": "Bob you said : \"I took the avg/min/max/nacount of each station (numeric only)\". If you did it for each station then Can you please tel me how did you append these features in the raw data.  \r\n\r\n[quote=Bob, Lord of Cats;136428]\r\n\r\nI managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.\r\n\r\nOn selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was \"unusual\" and represents a SWAG.  (I am a data science scrub).\r\n\r\n[/quote]",
      "votes": null
    },
    {
      "id": "136532",
      "postDate": "09/22/2016 18:01:06",
      "content": "<p>@Zohair</p>\n\n<p>I actually didnt append the data at all, I only used the summary data.</p>\n\n<p>what I did was something like this:</p>\n\n<pre><code>import pandas as pd\nimport numpy as np\nimport re\ntrain = pd.read_csv(&quot;./kaggle/Bosch/data/train_numeric.csv&quot;, chunksize=100000)\ntrain_new=pd.DataFrame()\ntoggle=0\nfor chunk in train:\n    print(&quot;-&quot;,end='')\n    if toggle == 0:\n        a=chunk.columns.values.tolist()\n        myString = '(L[0-9]*_S[0-9]*_) *'\n        pattern1 = r'\\b' + re.escape(myString) + r'\\b'\n        pattern=re.compile(myString)\n        indices = [i for i, x in enumerate(a) if re.search(pattern, x)]\n        i=0\n        for item in a:\n            if 'L' in item:\n                a[i]=re.search(pattern, a[i]).group(1)\n            i=i+1\n        a=list(set(a))\n    new_train=pd.DataFrame()\n    for item in a:\n        if (item=='Id' )| (item=='Response'):\n            new_train[item]=chunk[item]\n        else:\n            spike_cols = [col for col in chunk.columns if item in col]\n            mean=item+'mean'\n            nacount=item+'NAcount'\n            max_v=item+'max'\n            min_v=item+'min'\n            new_train[mean]=chunk[spike_cols].mean(axis=1)\n            new_train[nacount]=chunk[spike_cols].isnull().sum(axis=1)\n            new_train[max_v]=chunk[spike_cols].max(axis=1)\n            new_train[min_v]=chunk[spike_cols].min(axis=1)\n            cols=new_train.columns.values.tolist()\n            cols.sort()\n            new_train=new_train[cols]\n\n    if toggle==0:\n        new_train.to_csv(&quot;./kaggle/Bosch//data/train_num_smry.csv&quot;,mode='w',index=False,header=True)\n        toggle=1\n    else:\n        new_train.to_csv( &quot;./kaggle/Bosch//data/train_num_smry.csv&quot;,mode='a',index=False,header=False)\n</code></pre>",
      "rawMarkdown": "Zohair\r\n\r\nI actually didnt append the data at all, I only used the summary data.\r\n\r\nwhat I did was something like this:\r\n\r\n    import pandas as pd\r\n    import numpy as np\r\n    import re\r\n    train = pd.read_csv(\"./kaggle/Bosch/data/train_numeric.csv\", chunksize=100000)\r\n    train_new=pd.DataFrame()\r\n    toggle=0\r\n    for chunk in train:\r\n        print(\"-\",end='')\r\n        if toggle == 0:\r\n            a=chunk.columns.values.tolist()\r\n            myString = '(L[0-9]*_S[0-9]*_) *'\r\n            pattern1 = r'\\b' + re.escape(myString) + r'\\b'\r\n            pattern=re.compile(myString)\r\n            indices = [i for i, x in enumerate(a) if re.search(pattern, x)]\r\n            i=0\r\n            for item in a:\r\n                if 'L' in item:\r\n                    a[i]=re.search(pattern, a[i]).group(1)\r\n                i=i+1\r\n            a=list(set(a))\r\n        new_train=pd.DataFrame()\r\n        for item in a:\r\n            if (item=='Id' )| (item=='Response'):\r\n                new_train[item]=chunk[item]\r\n            else:\r\n                spike_cols = [col for col in chunk.columns if item in col]\r\n                mean=item+'mean'\r\n                nacount=item+'NAcount'\r\n                max_v=item+'max'\r\n                min_v=item+'min'\r\n                new_train[mean]=chunk[spike_cols].mean(axis=1)\r\n                new_train[nacount]=chunk[spike_cols].isnull().sum(axis=1)\r\n                new_train[max_v]=chunk[spike_cols].max(axis=1)\r\n                new_train[min_v]=chunk[spike_cols].min(axis=1)\r\n                cols=new_train.columns.values.tolist()\r\n                cols.sort()\r\n                new_train=new_train[cols]\r\n            \r\n        if toggle==0:\r\n            new_train.to_csv(\"./kaggle/Bosch//data/train_num_smry.csv\",mode='w',index=False,header=True)\r\n            toggle=1\r\n        else:\r\n            new_train.to_csv( \"./kaggle/Bosch//data/train_num_smry.csv\",mode='a',index=False,header=False)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 136425,
      "author_name": "davidthaler",
      "author_url": "",
      "post_date": "09/21/2016 21:47:29",
      "content": "<p>VW should be fine on the categorical stuff, however, the categorical stuff seems to be relatively uninformative.     </p>\n\n<p>As for the numeric data, I suspect that the relationship between those numbers and the target is non-monotonic. In particular, for manufacturing defects, I would expect that extreme values (either high or low) of measurements are associated with defects. VW learns a linear model, so if you train it on the raw features, it will struggle with non-monotonic relationships. You may be able to use VW, but you probably need additional feature engineering.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136428,
      "author_name": "rdslater",
      "author_url": "",
      "post_date": "09/21/2016 21:54:42",
      "content": "<p>I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.</p>\n\n<p>On selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was &quot;unusual&quot; and represents a SWAG.  (I am a data science scrub).</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136429,
      "author_name": "notaapple",
      "author_url": "",
      "post_date": "09/21/2016 21:55:43",
      "content": "<p>Thanks for the advice.  I'll try that. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136480,
      "author_name": "zohairzohair4",
      "author_url": "",
      "post_date": "09/22/2016 09:51:10",
      "content": "<p>@Bob you said : &quot;I took the avg/min/max/nacount of each station (numeric only)&quot;. If you did it for each station then Can you please tel me how did you append these features in the raw data.  </p>\n\n<p>[quote=Bob, Lord of Cats;136428]</p>\n\n<p>I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.</p>\n\n<p>On selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was &quot;unusual&quot; and represents a SWAG.  (I am a data science scrub).</p>\n\n<p>[/quote]</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 136532,
      "author_name": "rdslater",
      "author_url": "",
      "post_date": "09/22/2016 18:01:06",
      "content": "<p>@Zohair</p>\n\n<p>I actually didnt append the data at all, I only used the summary data.</p>\n\n<p>what I did was something like this:</p>\n\n<pre><code>import pandas as pd\nimport numpy as np\nimport re\ntrain = pd.read_csv(&quot;./kaggle/Bosch/data/train_numeric.csv&quot;, chunksize=100000)\ntrain_new=pd.DataFrame()\ntoggle=0\nfor chunk in train:\n    print(&quot;-&quot;,end='')\n    if toggle == 0:\n        a=chunk.columns.values.tolist()\n        myString = '(L[0-9]*_S[0-9]*_) *'\n        pattern1 = r'\\b' + re.escape(myString) + r'\\b'\n        pattern=re.compile(myString)\n        indices = [i for i, x in enumerate(a) if re.search(pattern, x)]\n        i=0\n        for item in a:\n            if 'L' in item:\n                a[i]=re.search(pattern, a[i]).group(1)\n            i=i+1\n        a=list(set(a))\n    new_train=pd.DataFrame()\n    for item in a:\n        if (item=='Id' )| (item=='Response'):\n            new_train[item]=chunk[item]\n        else:\n            spike_cols = [col for col in chunk.columns if item in col]\n            mean=item+'mean'\n            nacount=item+'NAcount'\n            max_v=item+'max'\n            min_v=item+'min'\n            new_train[mean]=chunk[spike_cols].mean(axis=1)\n            new_train[nacount]=chunk[spike_cols].isnull().sum(axis=1)\n            new_train[max_v]=chunk[spike_cols].max(axis=1)\n            new_train[min_v]=chunk[spike_cols].min(axis=1)\n            cols=new_train.columns.values.tolist()\n            cols.sort()\n            new_train=new_train[cols]\n\n    if toggle==0:\n        new_train.to_csv(&quot;./kaggle/Bosch//data/train_num_smry.csv&quot;,mode='w',index=False,header=True)\n        toggle=1\n    else:\n        new_train.to_csv( &quot;./kaggle/Bosch//data/train_num_smry.csv&quot;,mode='a',index=False,header=False)\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "136422": "Has anyone have any progress with vowpal wabbit? Logistic function with default parameters results in 0.12411 on the private board. I'm having trouble improving it. I'm also using weighted importance to deal with the class imbalance problem.",
    "136425": "VW should be fine on the categorical stuff, however, the categorical stuff seems to be relatively uninformative.     \r\n\r\nAs for the numeric data, I suspect that the relationship between those numbers and the target is non-monotonic. In particular, for manufacturing defects, I would expect that extreme values (either high or low) of measurements are associated with defects. VW learns a linear model, so if you train it on the raw features, it will struggle with non-monotonic relationships. You may be able to use VW, but you probably need additional feature engineering.",
    "136428": "I managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.\r\n\r\nOn selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was \"unusual\" and represents a SWAG.  (I am a data science scrub).",
    "136429": "Thanks for the advice.  I'll try that.",
    "136480": "Bob you said : \"I took the avg/min/max/nacount of each station (numeric only)\". If you did it for each station then Can you please tel me how did you append these features in the raw data.  \r\n\r\n[quote=Bob, Lord of Cats;136428]\r\n\r\nI managed 0.18 on a first pass with default params (weighted class).  I suspect there is a fine deal of tuning and as Mr. Thaler mentions, some feature engineering may be of use.  I took the avg/min/max/nacount of each station (numeric only) and got 0.20 with an extra-trees model.\r\n\r\nOn selecting my cutoff critera, I used a guess based on number of defects in training set.  I assumed there would be the same number in my test set.  My cutoff was \"unusual\" and represents a SWAG.  (I am a data science scrub).\r\n\r\n[/quote]",
    "136532": "Zohair\r\n\r\nI actually didnt append the data at all, I only used the summary data.\r\n\r\nwhat I did was something like this:\r\n\r\n    import pandas as pd\r\n    import numpy as np\r\n    import re\r\n    train = pd.read_csv(\"./kaggle/Bosch/data/train_numeric.csv\", chunksize=100000)\r\n    train_new=pd.DataFrame()\r\n    toggle=0\r\n    for chunk in train:\r\n        print(\"-\",end='')\r\n        if toggle == 0:\r\n            a=chunk.columns.values.tolist()\r\n            myString = '(L[0-9]*_S[0-9]*_) *'\r\n            pattern1 = r'\\b' + re.escape(myString) + r'\\b'\r\n            pattern=re.compile(myString)\r\n            indices = [i for i, x in enumerate(a) if re.search(pattern, x)]\r\n            i=0\r\n            for item in a:\r\n                if 'L' in item:\r\n                    a[i]=re.search(pattern, a[i]).group(1)\r\n                i=i+1\r\n            a=list(set(a))\r\n        new_train=pd.DataFrame()\r\n        for item in a:\r\n            if (item=='Id' )| (item=='Response'):\r\n                new_train[item]=chunk[item]\r\n            else:\r\n                spike_cols = [col for col in chunk.columns if item in col]\r\n                mean=item+'mean'\r\n                nacount=item+'NAcount'\r\n                max_v=item+'max'\r\n                min_v=item+'min'\r\n                new_train[mean]=chunk[spike_cols].mean(axis=1)\r\n                new_train[nacount]=chunk[spike_cols].isnull().sum(axis=1)\r\n                new_train[max_v]=chunk[spike_cols].max(axis=1)\r\n                new_train[min_v]=chunk[spike_cols].min(axis=1)\r\n                cols=new_train.columns.values.tolist()\r\n                cols.sort()\r\n                new_train=new_train[cols]\r\n            \r\n        if toggle==0:\r\n            new_train.to_csv(\"./kaggle/Bosch//data/train_num_smry.csv\",mode='w',index=False,header=True)\r\n            toggle=1\r\n        else:\r\n            new_train.to_csv( \"./kaggle/Bosch//data/train_num_smry.csv\",mode='a',index=False,header=False)"
  },
  "source": "meta"
}