{
  "id": 76480,
  "title": "FFM for features generation",
  "url": "/competitions/elo-merchant-category-recommendation/discussion/76480",
  "author_name": "",
  "post_date": "2019-01-03T09:10:18.105062100Z",
  "votes": 18,
  "comment_count": 12,
  "views": 0,
  "content": "<p>FFM has been mentioned a lot in the Feature Engineering step at another discussion and public kernel. I tried FM for features generation (using feature_1, feature_2, feature_3) inspired by <a href=\"https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection/discussion/56497\">CPMP's implementation</a>. But It doesn't work!</p>\n\n<p>Has anyone implemented successfully with FFM? Can you share your experience?</p>\n\n<p>Thanks!</p>",
  "messages": [
    {
      "id": "449511",
      "postDate": "01/03/2019 09:10:18",
      "content": "<p>FFM has been mentioned a lot in the Feature Engineering step at another discussion and public kernel. I tried FM for features generation (using feature_1, feature_2, feature_3) inspired by <a href=\"https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection/discussion/56497\">CPMP's implementation</a>. But It doesn't work!</p>\n\n<p>Has anyone implemented successfully with FFM? Can you share your experience?</p>\n\n<p>Thanks!</p>",
      "rawMarkdown": "FFM has been mentioned a lot in the Feature Engineering step at another discussion and public kernel. I tried FM for features generation (using feature_1, feature_2, feature_3) inspired by [CPMP's implementation](https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection/discussion/56497). But It doesn't work!\n\nHas anyone implemented successfully with FFM? Can you share your experience?\n\nThanks!",
      "votes": null
    },
    {
      "id": "449703",
      "postDate": "01/03/2019 16:16:21",
      "content": "<p>Hi, Can you explain what do you means by it doesn't work?  Do you mean it didn't improve the performance? BTW I'm currently working on it</p>",
      "rawMarkdown": "Hi, Can you explain what do you means by it doesn't work?  Do you mean it didn't improve the performance? BTW I'm currently working on it",
      "votes": null
    },
    {
      "id": "449879",
      "postDate": "01/03/2019 22:37:14",
      "content": "<p>I implemented FM as mentioned here \n<a href=\"https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\">https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb</a>\nIt helped to improve the Lb score by 0.001. I used feature1, feature2, feature3 and couple of other features. Didn't explore much on other features. Also, used the defaults values of latent vector and embedding stuff. Just changed the sample weights. Also, couple of features were significant based on gain/split importance.</p>",
      "rawMarkdown": "I implemented FM as mentioned here \nhttps://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\nIt helped to improve the Lb score by 0.001. I used feature1, feature2, feature3 and couple of other features. Didn't explore much on other features. Also, used the defaults values of latent vector and embedding stuff. Just changed the sample weights. Also, couple of features were significant based on gain/split importance.",
      "votes": null
    },
    {
      "id": "449998",
      "postDate": "01/04/2019 04:57:47",
      "content": "<p>Yes, I tried it and generate some features is correlation of feature_1, feature_2, feture_3 like CPMP's implementation. But, It can't improve the score!</p>",
      "rawMarkdown": "Yes, I tried it and generate some features is correlation of feature_1, feature_2, feture_3 like CPMP's implementation. But, It can't improve the score!",
      "votes": null
    },
    {
      "id": "450505",
      "postDate": "01/05/2019 05:39:00",
      "content": "<p>Hi Harshi,\n      Train a ffm model and then use the result as a feature? i did this, but didn't help! thank you!</p>",
      "rawMarkdown": "Hi Harshi,\n      Train a ffm model and then use the result as a feature? i did this, but didn't help! thank you!",
      "votes": null
    },
    {
      "id": "450526",
      "postDate": "01/05/2019 07:22:27",
      "content": "<p>I tried FM on feature1, feature2, feature3, month_diff, RFM( recency frequency Monetary segmentation of card_id), then merge final features with original test and train dataset and helped to improve LB by 0.001</p>",
      "rawMarkdown": "I tried FM on feature1, feature2, feature3, month_diff, RFM( recency frequency Monetary segmentation of card_id), then merge final features with original test and train dataset and helped to improve LB by 0.001",
      "votes": null
    },
    {
      "id": "450530",
      "postDate": "01/05/2019 07:29:16",
      "content": "<p>thank you!  maybe i should do a feature slection next.</p>",
      "rawMarkdown": "thank you!  maybe i should do a feature slection next.",
      "votes": null
    },
    {
      "id": "450998",
      "postDate": "01/06/2019 08:41:05",
      "content": "<p>&gt; Train a ffm model and then use the result as a feature?</p>\n\n<p>That's not what I shared here: <a href=\"https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\">https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb</a>  You may want to read it as it is indeed using ffm to generate features.</p>",
      "rawMarkdown": "&gt; Train a ffm model and then use the result as a feature?\n\nThat's not what I shared here: https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb  You may want to read it as it is indeed using ffm to generate features.",
      "votes": null
    },
    {
      "id": "451000",
      "postDate": "01/06/2019 08:42:09",
      "content": "<p>It obviously depends on which features you use.  I have not entered this competition (yet) hence cannot say if that way of using ffm is useful or not.  But I see others being successful with it.</p>",
      "rawMarkdown": "It obviously depends on which features you use.  I have not entered this competition (yet) hence cannot say if that way of using ffm is useful or not.  But I see others being successful with it.",
      "votes": null
    },
    {
      "id": "452939",
      "postDate": "01/09/2019 11:32:07",
      "content": "<p>Yes, maybe the feature we choose is the key. i just use feature in train.csv, which seems doesn't help!</p>",
      "rawMarkdown": "Yes, maybe the feature we choose is the key. i just use feature in train.csv, which seems doesn't help!",
      "votes": null
    },
    {
      "id": "457373",
      "postDate": "01/17/2019 09:46:08",
      "content": "<p>I tried on all my category features. The loss of the Keras model is much smaller compared the model shared in original competition. It really worked for local CV. But it did not improve LB score. Anyway, it helped me learn more. Thanks for the notebook sharing to the original author!</p>",
      "rawMarkdown": "I tried on all my category features. The loss of the Keras model is much smaller compared the model shared in original competition. It really worked for local CV. But it did not improve LB score. Anyway, it helped me learn more. Thanks for the notebook sharing to the original author!",
      "votes": null
    },
    {
      "id": "461333",
      "postDate": "01/25/2019 19:25:12",
      "content": "<p>The code provided by the link is limited to small features sets. If I want to work with co-occurrence matrix (cards vs merchants) the it will be an array of 300k x 300k.\nIn this case I think sparse matrix can help, but the code is not working with it.</p>",
      "rawMarkdown": "The code provided by the link is limited to small features sets. If I want to work with co-occurrence matrix (cards vs merchants) the it will be an array of 300k x 300k.\nIn this case I think sparse matrix can help, but the code is not working with it.",
      "votes": null
    },
    {
      "id": "461400",
      "postDate": "01/25/2019 22:52:28",
      "content": "<p>If you want to factor a 2D matrix then you should use SVD.  You don't need libFFM for that, and I don't even get how you can use my code for it as my code factors a sparse 3D matrix.  </p>",
      "rawMarkdown": "If you want to factor a 2D matrix then you should use SVD.  You don't need libFFM for that, and I don't even get how you can use my code for it as my code factors a sparse 3D matrix.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 449703,
      "author_name": "luuunh",
      "author_url": "",
      "post_date": "01/03/2019 16:16:21",
      "content": "<p>Hi, Can you explain what do you means by it doesn't work?  Do you mean it didn't improve the performance? BTW I'm currently working on it</p>",
      "votes": null,
      "replies": [
        {
          "id": 449998,
          "author_name": "",
          "author_url": "",
          "post_date": "01/04/2019 04:57:47",
          "content": "<p>Yes, I tried it and generate some features is correlation of feature_1, feature_2, feture_3 like CPMP's implementation. But, It can't improve the score!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 449879,
      "author_name": "harshit92",
      "author_url": "",
      "post_date": "01/03/2019 22:37:14",
      "content": "<p>I implemented FM as mentioned here \n<a href=\"https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\">https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb</a>\nIt helped to improve the Lb score by 0.001. I used feature1, feature2, feature3 and couple of other features. Didn't explore much on other features. Also, used the defaults values of latent vector and embedding stuff. Just changed the sample weights. Also, couple of features were significant based on gain/split importance.</p>",
      "votes": null,
      "replies": [
        {
          "id": 450505,
          "author_name": "codlife",
          "author_url": "",
          "post_date": "01/05/2019 05:39:00",
          "content": "<p>Hi Harshi,\n      Train a ffm model and then use the result as a feature? i did this, but didn't help! thank you!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 450526,
          "author_name": "harshit92",
          "author_url": "",
          "post_date": "01/05/2019 07:22:27",
          "content": "<p>I tried FM on feature1, feature2, feature3, month_diff, RFM( recency frequency Monetary segmentation of card_id), then merge final features with original test and train dataset and helped to improve LB by 0.001</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 450530,
          "author_name": "codlife",
          "author_url": "",
          "post_date": "01/05/2019 07:29:16",
          "content": "<p>thank you!  maybe i should do a feature slection next.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 450998,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "01/06/2019 08:41:05",
          "content": "<p>&gt; Train a ffm model and then use the result as a feature?</p>\n\n<p>That's not what I shared here: <a href=\"https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\">https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb</a>  You may want to read it as it is indeed using ffm to generate features.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 461333,
          "author_name": "kmedvedev",
          "author_url": "",
          "post_date": "01/25/2019 19:25:12",
          "content": "<p>The code provided by the link is limited to small features sets. If I want to work with co-occurrence matrix (cards vs merchants) the it will be an array of 300k x 300k.\nIn this case I think sparse matrix can help, but the code is not working with it.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 461400,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "01/25/2019 22:52:28",
          "content": "<p>If you want to factor a 2D matrix then you should use SVD.  You don't need libFFM for that, and I don't even get how you can use my code for it as my code factors a sparse 3D matrix.  </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 451000,
      "author_name": "cpmpml",
      "author_url": "",
      "post_date": "01/06/2019 08:42:09",
      "content": "<p>It obviously depends on which features you use.  I have not entered this competition (yet) hence cannot say if that way of using ffm is useful or not.  But I see others being successful with it.</p>",
      "votes": null,
      "replies": [
        {
          "id": 452939,
          "author_name": "codlife",
          "author_url": "",
          "post_date": "01/09/2019 11:32:07",
          "content": "<p>Yes, maybe the feature we choose is the key. i just use feature in train.csv, which seems doesn't help!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 457373,
          "author_name": "xiaojiu1414",
          "author_url": "",
          "post_date": "01/17/2019 09:46:08",
          "content": "<p>I tried on all my category features. The loss of the Keras model is much smaller compared the model shared in original competition. It really worked for local CV. But it did not improve LB score. Anyway, it helped me learn more. Thanks for the notebook sharing to the original author!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "449511": "FFM has been mentioned a lot in the Feature Engineering step at another discussion and public kernel. I tried FM for features generation (using feature_1, feature_2, feature_3) inspired by [CPMP's implementation](https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection/discussion/56497). But It doesn't work!\n\nHas anyone implemented successfully with FFM? Can you share your experience?\n\nThanks!",
    "449703": "Hi, Can you explain what do you means by it doesn't work?  Do you mean it didn't improve the performance? BTW I'm currently working on it",
    "449879": "I implemented FM as mentioned here \nhttps://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb\nIt helped to improve the Lb score by 0.001. I used feature1, feature2, feature3 and couple of other features. Didn't explore much on other features. Also, used the defaults values of latent vector and embedding stuff. Just changed the sample weights. Also, couple of features were significant based on gain/split importance.",
    "449998": "Yes, I tried it and generate some features is correlation of feature_1, feature_2, feture_3 like CPMP's implementation. But, It can't improve the score!",
    "450505": "Hi Harshi,\n      Train a ffm model and then use the result as a feature? i did this, but didn't help! thank you!",
    "450526": "I tried FM on feature1, feature2, feature3, month_diff, RFM( recency frequency Monetary segmentation of card_id), then merge final features with original test and train dataset and helped to improve LB by 0.001",
    "450530": "thank you!  maybe i should do a feature slection next.",
    "450998": "&gt; Train a ffm model and then use the result as a feature?\n\nThat's not what I shared here: https://github.com/jfpuget/LibFM_in_Keras/blob/master/keras_blog.ipynb  You may want to read it as it is indeed using ffm to generate features.",
    "451000": "It obviously depends on which features you use.  I have not entered this competition (yet) hence cannot say if that way of using ffm is useful or not.  But I see others being successful with it.",
    "452939": "Yes, maybe the feature we choose is the key. i just use feature in train.csv, which seems doesn't help!",
    "457373": "I tried on all my category features. The loss of the Keras model is much smaller compared the model shared in original competition. It really worked for local CV. But it did not improve LB score. Anyway, it helped me learn more. Thanks for the notebook sharing to the original author!",
    "461333": "The code provided by the link is limited to small features sets. If I want to work with co-occurrence matrix (cards vs merchants) the it will be an array of 300k x 300k.\nIn this case I think sparse matrix can help, but the code is not working with it.",
    "461400": "If you want to factor a 2D matrix then you should use SVD.  You don't need libFFM for that, and I don't even get how you can use my code for it as my code factors a sparse 3D matrix."
  },
  "source": "meta"
}