{
  "id": 9489,
  "title": "Feature Engineering and categorical variable question",
  "url": "/competitions/acquire-valued-shoppers-challenge/discussion/9489",
  "author_name": "",
  "post_date": "2014-06-17T22:22:47.230Z",
  "votes": 1,
  "comment_count": 3,
  "views": 2445,
  "content": "<p>Hi forum,&nbsp;</p>\n\n<p>First thank you for the experts who have shared their approach in getting newbies started. &nbsp;</p>\n<p>I am following Triskelion's approach to generate features, and got into this question: should one leave the variables such as company, brand, category, and chain in the feature set? &nbsp;Clearly these variables have prediction power, as different company / categoery / stores may have inherently different characteristics that&nbsp;encourage or&nbsp;repel repeated purchase. &nbsp;However, if I were to include these variables as features, I find that feeding&nbsp;them directly into a logistic regression or random forest may not make sense, as the apparent ordering of the values does not mean anything (for example, companies 1324 and 3212), but logistic regression will assume ordering. &nbsp;</p>\n<p>How do you deal with this problem and utilize the predicting power of these variables?</p>\n<p>Thank you!&nbsp;</p>",
  "messages": [
    {
      "id": "49263",
      "postDate": "06/17/2014 22:22:47",
      "content": "<p>Hi forum,&nbsp;</p>\n\n<p>First thank you for the experts who have shared their approach in getting newbies started. &nbsp;</p>\n<p>I am following Triskelion's approach to generate features, and got into this question: should one leave the variables such as company, brand, category, and chain in the feature set? &nbsp;Clearly these variables have prediction power, as different company / categoery / stores may have inherently different characteristics that&nbsp;encourage or&nbsp;repel repeated purchase. &nbsp;However, if I were to include these variables as features, I find that feeding&nbsp;them directly into a logistic regression or random forest may not make sense, as the apparent ordering of the values does not mean anything (for example, companies 1324 and 3212), but logistic regression will assume ordering. &nbsp;</p>\n<p>How do you deal with this problem and utilize the predicting power of these variables?</p>\n<p>Thank you!&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49265",
      "postDate": "06/18/2014 02:13:26",
      "content": "<p>You can use binary variables to deal with categorical features.&nbsp;See&nbsp;http://en.wikipedia.org/wiki/Dummy_variable_(statistics)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49272",
      "postDate": "06/18/2014 06:51:05",
      "content": "<p>This might help :&nbsp;https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/9415/categorical-features-in-vowpal-wabbit</p>\n\n\n<p>Rohit</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49278",
      "postDate": "06/18/2014 14:39:31",
      "content": "<p>[quote=snowblind;49265]</p>\n<p>You can use binary variables to deal with categorical features.&nbsp;See&nbsp;http://en.wikipedia.org/wiki/Dummy_variable_(statistics)</p>\n<p>[/quote]</p>\n\n<p>Yep. &nbsp;So if you're trying to capture the fact that the customer shopped at chain X, you could set a variable called &quot;bought_at_chain_X&quot; to 1 (in, say, Vowpal Wabbit). &nbsp;Because of the way the test set and the train set differ in this competition, there are some of these encodings that have more value than others, but they can certainly be powerful predictors.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 49265,
      "author_name": "punits",
      "author_url": "",
      "post_date": "06/18/2014 02:13:26",
      "content": "<p>You can use binary variables to deal with categorical features.&nbsp;See&nbsp;http://en.wikipedia.org/wiki/Dummy_variable_(statistics)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49272,
      "author_name": "rohit49",
      "author_url": "",
      "post_date": "06/18/2014 06:51:05",
      "content": "<p>This might help :&nbsp;https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/9415/categorical-features-in-vowpal-wabbit</p>\n\n\n<p>Rohit</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49278,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "06/18/2014 14:39:31",
      "content": "<p>[quote=snowblind;49265]</p>\n<p>You can use binary variables to deal with categorical features.&nbsp;See&nbsp;http://en.wikipedia.org/wiki/Dummy_variable_(statistics)</p>\n<p>[/quote]</p>\n\n<p>Yep. &nbsp;So if you're trying to capture the fact that the customer shopped at chain X, you could set a variable called &quot;bought_at_chain_X&quot; to 1 (in, say, Vowpal Wabbit). &nbsp;Because of the way the test set and the train set differ in this competition, there are some of these encodings that have more value than others, but they can certainly be powerful predictors.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "49263": "",
    "49265": "",
    "49272": "",
    "49278": ""
  },
  "source": "meta"
}