{
  "id": 11315,
  "title": "not asking for your secret sauce recipe but....",
  "url": "/competitions/avazu-ctr-prediction/discussion/11315",
  "author_name": "",
  "post_date": "2014-12-22T16:44:38.117Z",
  "votes": 4,
  "comment_count": 13,
  "views": 5998,
  "content": "<p>Hi there,</p>\n<p>I wondered if anyone tried manufacturing synthetic features using a decision tree-like algorithm. &nbsp;The winner solution at the Criteo competition used that technique, and there is a known paper from facebook on the topic (http://quinonero.net/Publications/predicting-clicks-facebook.pdf).</p>\n<p>Well, the results I got following this recipe were absolutely disappointing. &nbsp;It might have well been that I implemented this strategy poorly, but I did try to tweak it a few times and no results to show for.</p>\n<p>Has anyone else ventured into this road? anything you can share?</p>\n<p>Thanks!</p>\n<p>A</p>",
  "messages": [
    {
      "id": "61675",
      "postDate": "12/22/2014 16:44:38",
      "content": "<p>Hi there,</p>\n<p>I wondered if anyone tried manufacturing synthetic features using a decision tree-like algorithm. &nbsp;The winner solution at the Criteo competition used that technique, and there is a known paper from facebook on the topic (http://quinonero.net/Publications/predicting-clicks-facebook.pdf).</p>\n<p>Well, the results I got following this recipe were absolutely disappointing. &nbsp;It might have well been that I implemented this strategy poorly, but I did try to tweak it a few times and no results to show for.</p>\n<p>Has anyone else ventured into this road? anything you can share?</p>\n<p>Thanks!</p>\n<p>A</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "61990",
      "postDate": "12/29/2014 04:30:27",
      "content": "<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "61999",
      "postDate": "12/29/2014 09:19:39",
      "content": "<p>[quote=Florian Muellerklein;61990]</p>\n<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>\n<p>[/quote]</p>\n<p>You can use sklearn (see attached file) or xgboost for instance</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62004",
      "postDate": "12/29/2014 12:05:51",
      "content": "<p>Wow! You are my hero, I wish that I could buy you a beer.&nbsp;</p>\n<p>I kept trying&nbsp;indices.append(tree.apply(x.astype(np.float32)) but that wouldn't work. As a python noob, I can't figure out why your method worked and mine didn't but I'm really grateful for your solution. Thanks again.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62006",
      "postDate": "12/29/2014 12:21:31",
      "content": "<p>Hi there, Faron, I second Florian's comments. &nbsp;Thanks so much for providing the code.</p>\n<p>@Florian: I tried sklearn.ensemble.RandomTreesEmbedding, method&nbsp;fit_transform() but it appears that the &quot;random&quot; in the library name is there for one reason. &nbsp;Conclusion: the tree indexes appear to be assigned totally at random, and the log loss does not improve at all after adding the tree indexes.</p>\n<p>I thought about playing a bit with the code of sklearn.ensemble.GradientBoostingRegressor and change it to return the tree indexes, but no luck so far.</p>\n<p>@ Faron or anyone else, feel free to comment, especially on changing the code of&nbsp;GradientBoostingRegressor to return the tree indexes.</p>\n<p>Thanks a lot!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62009",
      "postDate": "12/29/2014 13:44:47",
      "content": "<p>[quote=Faron;61999]</p>\n<p>[quote=Florian Muellerklein;61990]</p>\n<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>\n<p>[/quote]</p>\n<p>You can use sklearn (see attached file) or xgboost for instance</p>\n<p>[/quote]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62010",
      "postDate": "12/29/2014 14:14:45",
      "content": "<p>Isn't this technique particularly useful for binning numerical features to categoricals ?</p>\n<p>Using trees to &quot;bin&quot; values is better than ie.&nbsp;cutting the space up in even parts.</p>\n<p>Perhaps that's why it's not so effective in this challenge..</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62012",
      "postDate": "12/29/2014 14:51:50",
      "content": "<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62029",
      "postDate": "12/29/2014 19:13:58",
      "content": "<p>[quote=Faron;62012]</p>\n<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>\n<p>[/quote]</p>\n<p>Thanks @Faron!</p>\n<p>Look like it isn't&nbsp;supported any more (or supported differently). I'm getting that error:</p>\n<p>TypeError: predict() got an unexpected keyword argument 'pred_leaf'</p>\n<p>This is how the&nbsp;predict function currently defined:</p>\n<p>def predict(self, data, output_margin=False, ntree_limit=0)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62036",
      "postDate": "12/29/2014 19:49:09",
      "content": "<p>[quote=clustifier;62029]</p>\n<p>[quote=Faron;62012]</p>\n<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>\n<p>[/quote]</p>\n<p>Thanks @Faron!</p>\n<p>Look like it isn't&nbsp;supported any more (or supported differently). I'm getting that error:</p>\n<p>TypeError: predict() got an unexpected keyword argument 'pred_leaf'</p>\n<p>This is how the&nbsp;predict function currently defined:</p>\n<p>def predict(self, data, output_margin=False, ntree_limit=0)</p>\n<p>[/quote]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62058",
      "postDate": "12/29/2014 22:00:52",
      "content": "",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62087",
      "postDate": "12/30/2014 05:38:38",
      "content": "<p>[quote=Faron;62036]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>\n<p>[/quote]</p>\n\n<p>Hi Faron - would you know if we can install the unity branch then? I was trying to install, but &quot;make&quot; spits out an error that &quot;rabit.h&quot; is not found... Is the branch still in development that is not ready for users?&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "62156",
      "postDate": "12/31/2014 22:19:07",
      "content": "<p>[quote=AS;61675]</p>\n<p>Hi there,</p>\n<p>I wondered if anyone tried manufacturing synthetic features using a decision tree-like algorithm. &nbsp;The winner solution at the Criteo competition used that technique, and there is a known paper from facebook on the topic (http://quinonero.net/Publications/predicting-clicks-facebook.pdf).</p>\n<p>Well, the results I got following this recipe were absolutely disappointing. &nbsp;It might have well been that I implemented this strategy poorly, but I did try to tweak it a few times and no results to show for.</p>\n<p>Has anyone else ventured into this road? anything you can share?</p>\n<p>Thanks!</p>\n<p>A</p>\n<p>[/quote]</p>\n<p>It is funny how this was &quot;rediscovered&quot;. It dates back to at least 1998, albeit using CART instead of an ensemble of trees. http://media.salford-systems.com/pdf/the-hybrid-cart-logit-model-in-classification-and-data%20mining-1998.pdf</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "63303",
      "postDate": "01/29/2015 13:10:42",
      "content": "<p>[quote=DerekZH;62087]</p>\n<p>[quote=Faron;62036]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>\n<p>[/quote]</p>\n<p>Hi Faron - would you know if we can install the unity branch then? I was trying to install, but &quot;make&quot; spits out an error that &quot;rabit.h&quot; is not found... Is the branch still in development that is not ready for users?&nbsp;</p>\n<p>[/quote]</p>\n<p>It's in the master branch now.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 61990,
      "author_name": "florianm",
      "author_url": "",
      "post_date": "12/29/2014 04:30:27",
      "content": "<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 61999,
      "author_name": "mmueller",
      "author_url": "",
      "post_date": "12/29/2014 09:19:39",
      "content": "<p>[quote=Florian Muellerklein;61990]</p>\n<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>\n<p>[/quote]</p>\n<p>You can use sklearn (see attached file) or xgboost for instance</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62004,
      "author_name": "florianm",
      "author_url": "",
      "post_date": "12/29/2014 12:05:51",
      "content": "<p>Wow! You are my hero, I wish that I could buy you a beer.&nbsp;</p>\n<p>I kept trying&nbsp;indices.append(tree.apply(x.astype(np.float32)) but that wouldn't work. As a python noob, I can't figure out why your method worked and mine didn't but I'm really grateful for your solution. Thanks again.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62006,
      "author_name": "asimkievich",
      "author_url": "",
      "post_date": "12/29/2014 12:21:31",
      "content": "<p>Hi there, Faron, I second Florian's comments. &nbsp;Thanks so much for providing the code.</p>\n<p>@Florian: I tried sklearn.ensemble.RandomTreesEmbedding, method&nbsp;fit_transform() but it appears that the &quot;random&quot; in the library name is there for one reason. &nbsp;Conclusion: the tree indexes appear to be assigned totally at random, and the log loss does not improve at all after adding the tree indexes.</p>\n<p>I thought about playing a bit with the code of sklearn.ensemble.GradientBoostingRegressor and change it to return the tree indexes, but no luck so far.</p>\n<p>@ Faron or anyone else, feel free to comment, especially on changing the code of&nbsp;GradientBoostingRegressor to return the tree indexes.</p>\n<p>Thanks a lot!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62009,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "12/29/2014 13:44:47",
      "content": "<p>[quote=Faron;61999]</p>\n<p>[quote=Florian Muellerklein;61990]</p>\n<p>What did you use to create and pull the tree features? I also wanted to try this but using python I didn't find any .apply function for the GradientBoostingClassifier like there is for RandomForest.&nbsp;</p>\n<p>[/quote]</p>\n<p>You can use sklearn (see attached file) or xgboost for instance</p>\n<p>[/quote]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62010,
      "author_name": "juliandewit",
      "author_url": "",
      "post_date": "12/29/2014 14:14:45",
      "content": "<p>Isn't this technique particularly useful for binning numerical features to categoricals ?</p>\n<p>Using trees to &quot;bin&quot; values is better than ie.&nbsp;cutting the space up in even parts.</p>\n<p>Perhaps that's why it's not so effective in this challenge..</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62012,
      "author_name": "mmueller",
      "author_url": "",
      "post_date": "12/29/2014 14:51:50",
      "content": "<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62029,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "12/29/2014 19:13:58",
      "content": "<p>[quote=Faron;62012]</p>\n<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>\n<p>[/quote]</p>\n<p>Thanks @Faron!</p>\n<p>Look like it isn't&nbsp;supported any more (or supported differently). I'm getting that error:</p>\n<p>TypeError: predict() got an unexpected keyword argument 'pred_leaf'</p>\n<p>This is how the&nbsp;predict function currently defined:</p>\n<p>def predict(self, data, output_margin=False, ntree_limit=0)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62036,
      "author_name": "mmueller",
      "author_url": "",
      "post_date": "12/29/2014 19:49:09",
      "content": "<p>[quote=clustifier;62029]</p>\n<p>[quote=Faron;62012]</p>\n<p>[quote=clustifier;62009]</p>\n<p>What about&nbsp;xgboost?&nbsp;</p>\n<p>Does&nbsp;the python&nbsp;interface&nbsp;also can access the trees?</p>\n<p>[/quote]</p>\n<p>see: https://github.com/tqchen/xgboost/blob/unity/demo/guide-python/predict_leaf_indices.py</p>\n<p>[/quote]</p>\n<p>Thanks @Faron!</p>\n<p>Look like it isn't&nbsp;supported any more (or supported differently). I'm getting that error:</p>\n<p>TypeError: predict() got an unexpected keyword argument 'pred_leaf'</p>\n<p>This is how the&nbsp;predict function currently defined:</p>\n<p>def predict(self, data, output_margin=False, ntree_limit=0)</p>\n<p>[/quote]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62058,
      "author_name": "inspector",
      "author_url": "",
      "post_date": "12/29/2014 22:00:52",
      "content": "",
      "votes": null,
      "replies": []
    },
    {
      "id": 62087,
      "author_name": "derekzh",
      "author_url": "",
      "post_date": "12/30/2014 05:38:38",
      "content": "<p>[quote=Faron;62036]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>\n<p>[/quote]</p>\n\n<p>Hi Faron - would you know if we can install the unity branch then? I was trying to install, but &quot;make&quot; spits out an error that &quot;rabit.h&quot; is not found... Is the branch still in development that is not ready for users?&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 62156,
      "author_name": "inspector",
      "author_url": "",
      "post_date": "12/31/2014 22:19:07",
      "content": "<p>[quote=AS;61675]</p>\n<p>Hi there,</p>\n<p>I wondered if anyone tried manufacturing synthetic features using a decision tree-like algorithm. &nbsp;The winner solution at the Criteo competition used that technique, and there is a known paper from facebook on the topic (http://quinonero.net/Publications/predicting-clicks-facebook.pdf).</p>\n<p>Well, the results I got following this recipe were absolutely disappointing. &nbsp;It might have well been that I implemented this strategy poorly, but I did try to tweak it a few times and no results to show for.</p>\n<p>Has anyone else ventured into this road? anything you can share?</p>\n<p>Thanks!</p>\n<p>A</p>\n<p>[/quote]</p>\n<p>It is funny how this was &quot;rediscovered&quot;. It dates back to at least 1998, albeit using CART instead of an ensemble of trees. http://media.salford-systems.com/pdf/the-hybrid-cart-logit-model-in-classification-and-data%20mining-1998.pdf</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 63303,
      "author_name": "mmueller",
      "author_url": "",
      "post_date": "01/29/2015 13:10:42",
      "content": "<p>[quote=DerekZH;62087]</p>\n<p>[quote=Faron;62036]</p>\n<p>this feature is only present in the &quot;unity&quot; branch (not merged into &quot;master&quot; yet).</p>\n<p>[/quote]</p>\n<p>Hi Faron - would you know if we can install the unity branch then? I was trying to install, but &quot;make&quot; spits out an error that &quot;rabit.h&quot; is not found... Is the branch still in development that is not ready for users?&nbsp;</p>\n<p>[/quote]</p>\n<p>It's in the master branch now.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "61675": "",
    "61990": "",
    "61999": "",
    "62004": "",
    "62006": "",
    "62009": "",
    "62010": "",
    "62012": "",
    "62029": "",
    "62036": "",
    "62058": "",
    "62087": "",
    "62156": "",
    "63303": ""
  },
  "source": "meta"
}