{
  "id": 12608,
  "title": "4 Idiots' Solution & LIBFFM",
  "url": "/competitions/avazu-ctr-prediction/writeups/4-idiots-4-idiots-solution-libffm",
  "author_name": "",
  "post_date": "2015-02-25T14:20:42.840Z",
  "votes": 74,
  "comment_count": 61,
  "views": 35627,
  "content": "<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>",
  "messages": [
    {
      "id": "64863",
      "postDate": "02/25/2015 14:20:42",
      "content": "<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64865",
      "postDate": "02/25/2015 14:36:59",
      "content": "<p>Thank you very much! I have a question :D &nbsp;Why is the FFM particularly good for this problem? What data structure/characteristic in general is FFM suitable for ? Thank you and congratulations again!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64869",
      "postDate": "02/25/2015 15:11:11",
      "content": "<p>Awesome - thank you for sharing!</p>\n\n<p>One basic question up front : Is a field aware FM the same as a FM (e.g. LIBFM) trained on data set that has a distinct name spaces for every predictor (using 'name space' to mean the role played by this concept in Vowpal Wabbit)? So for example if there were two predictors in a data set:</p>\n<p>A which takes values 'RED' and 'BLUE'</p>\n<p>B which also takes values 'RED' and 'BLUE'</p>\n\n<p>Instead of having data that hashed RED and BLUE to the same value for both A and B, the data would be A_RED or B_RED thus properly treating them as two separate things? Or is there more to it? :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64871",
      "postDate": "02/25/2015 15:59:02",
      "content": "<p>[quote=rcarson;64865]</p>\n<p>What data structure/characteristic in general is FFM suitable for?</p>\n<p>[/quote]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to <del>3</del> 4 Idiots for releasing LIBFFM. Will play around with it and report back.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64872",
      "postDate": "02/25/2015 16:09:15",
      "content": "<p>[quote=Triskelion;64871]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to 3 Idiots for releasing LIBFFM. Wil play around with it and report back.</p>\n<p>[/quote]</p>\n<p>Thank you very much! That's an excellent paper :D</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64903",
      "postDate": "02/26/2015 01:41:04",
      "content": "<p>Excellent work indeed!</p>\n<p>And Thanks for the FFM library</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64910",
      "postDate": "02/26/2015 03:41:17",
      "content": "<p>[quote=rcarson;64872]</p>\n<p>[quote=Triskelion;64871]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to 3 Idiots for releasing LIBFFM. Wil play around with it and report back.</p>\n<p>[/quote]</p>\n<p>Thank you very much! That's an excellent paper :D</p>\n<p>[/quote]</p>\n<p>Thanks! Here are my opinions for your questions:</p>\n<p>1. As Triskelion has mentioned, I agree with section IV in <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">Rendle's paper</a>&nbsp;is a<br> good explanation for the reason why FM-based models can be better than<br> SVM-based models on sparse datasets.</p>\n<p>2. For this question, I have no idea. So far I have only used FFM on CTR<br> datasets. I am also very interested to see if it works on other types of<br> data. That's why we released LIBFFM. :D</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64936",
      "postDate": "02/26/2015 11:52:21",
      "content": "<p>[quote=guestwalk;64863]</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>[/quote]</p>\n<p>Hi, guestwalk,</p>\n<p>Thank you very much for sharing and congratulation! I would like to ask the question about implementation: in stochastic gradient descent (file ffm.cpp, function wTx) you used the update w &nbsp;= w - lr * \\sqrt(1+sum of squares of previous gradients) * gradient. I am wondering why you used this factor&nbsp;\\sqrt(1+sum of squares of previous gradients)? Maybe you could give some links for the description of this idea?</p>\n<p>Dmitry.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64938",
      "postDate": "02/26/2015 12:08:53",
      "content": "<p>[quote=Dmitry Efimov;64936]</p>\n<p>[quote=guestwalk;64863]</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>[/quote]</p>\n<p>Hi, guestwalk,</p>\n<p>Thank you very much for sharing and congratulation! I would like to ask the question about implementation: in stochastic gradient descent (file ffm.cpp, function wTx) you used the update w &nbsp;= w - lr * \\sqrt(1+sum of squares of previous gradients) * gradient. I am wondering why you used this factor&nbsp;\\sqrt(1+sum of squares of previous gradients)? Maybe you could give some links for the description of this idea?</p>\n<p>Dmitry.</p>\n<p>[/quote]</p>\n<p>Hi Dmitry, this learning-rate schedule is described in our <a href=\"http://www.csie.ntu.edu.tw/~cjlin/papers/libmf/mf_adaptive_pakdd.pdf\">recent paper</a>. Hope it is useful for you.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64943",
      "postDate": "02/26/2015 13:01:00",
      "content": "<p>Great! Thanks!</p>\n<p>One more question, could you explain a little bit more about parameter &quot;v&quot; you are using for prediction? If I understood correctly, you need this parameter to adjust weights only (to avoid them to be very small). Is it correct? Or you need this parameter for something else?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "64999",
      "postDate": "02/26/2015 22:47:32",
      "content": "<p>[quote=Dmitry Efimov;64943]</p>\n<p>Great! Thanks!</p>\n<p>One more question, could you explain a little bit more about parameter &quot;v&quot; you are using for prediction? If I understood correctly, you need this parameter to adjust weights only (to avoid them to be very small). Is it correct? Or you need this parameter for something else?</p>\n<p>[/quote]</p>\n<p>Sorry I don't quite understand. Do you mean &quot;ffm_float v&quot; in &quot;struct ffm_node&quot;??</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65009",
      "postDate": "02/27/2015 05:15:39",
      "content": "<p>Yes, right! In your previous version it was 2/nr_field. In new version you defined it as&nbsp;2.0f*v1*v2*r in function wTx, file ffm.cpp.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65016",
      "postDate": "02/27/2015 10:06:07",
      "content": "<p>Okay I see!</p>\n<p>1. &quot;v1&quot; and &quot;v2&quot; respectively are x_j1 and x_j2 in page 6 in <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">this slide</a>.</p>\n<p>2. &quot;r&quot; is the normalization constant, when auto-normalization is not enabled, it is always 1; and if it is enabled, we automatically normalize each instance. For example, if we have x = &quot;1:3:1 2:7:2 3:9:1.5&quot;, and normalization is enabled, then r = 1/sqrt(1*1+2*2+1.5*1.5).</p>\n<p>3. For the constant &quot;2.0f.&quot; Sorry I don't have a good explanation now. Actually FFM still works if this constant is removed, but empirically I find adding this constant makes the convergence faster. One possible reason is that FFM is used to model interactions between features. If we consider polynomial models, for instance, (x1+x2+x3)^2 = x1^2+x2^2+x3^2+2*x1*x2+2*x1*x3+2*x2*x3. The interaction terms have &quot;2&quot; here, so I also have this &quot;2&quot; in FFM.</p>\n<p>Please feel free to let me know if the explanations above are not clear.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65021",
      "postDate": "02/27/2015 11:37:32",
      "content": "<p>Yes, it is clear now, thank you very much! This is really great work!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65052",
      "postDate": "02/27/2015 17:26:21",
      "content": "<p>[quote=Inspector;64869]</p>\n<p>Awesome - thank you for sharing!</p>\n<p>One basic question up front : Is a field aware FM the same as a FM (e.g. LIBFM) trained on data set that has a distinct name spaces for every predictor (using 'name space' to mean the role played by this concept in Vowpal Wabbit)? So for example if there were two predictors in a data set:</p>\n<p>A which takes values 'RED' and 'BLUE'</p>\n<p>B which also takes values 'RED' and 'BLUE'</p>\n<p>Instead of having data that hashed RED and BLUE to the same value for both A and B, the data would be A_RED or B_RED thus properly treating them as two separate things? Or is there more to it? :)</p>\n<p>[/quote]</p>\n<p>Sorry I still don't quite understand what &quot;name space&quot; is. In your example, my understanding is: &quot;A&quot; and &quot;B&quot; are predictors, and &quot;RED&quot; and &quot;BLUE&quot; are values. Assuming my understanding is correct, in your first question you have the term &quot;name spaces for every predictors.&quot; So in your example, what are namespaces for &quot;A&quot; and &quot;B,&quot; respectively? Thanks! :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65099",
      "postDate": "02/28/2015 03:33:11",
      "content": "<p>Congratulations, thank you for sharing your solution. But I&nbsp;have some concerns about the FFM model. In practice,&nbsp;especially when use it in&nbsp;prediction, this model need too many&nbsp;parameters for sparse features. In&nbsp;standard FM model, each sparse feature only has one dense vector of latent factors. &nbsp;But in FFM model, each&nbsp;sparse feature have N(number of feature&nbsp;field) - 1&nbsp;dense vectors to be&nbsp;stored. If both of the&nbsp;dimension of sparse features and number of&nbsp;feature field are big, the&nbsp;storage of the FFM model in single machine will be&nbsp;challenge in model training and online prediction. Do you have any&nbsp;advice for this problem?&nbsp;</p>\n<p>Thanks again!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65105",
      "postDate": "02/28/2015 05:14:11",
      "content": "<p>[quote=guestwalk;64863]</p>\n<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>\n<p>[/quote]</p>\n\n<p>what purpose of bag features?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65143",
      "postDate": "02/28/2015 18:22:48",
      "content": "<p>[quote=lynn;65099]</p>\n<p>Congratulations, thank you for sharing your solution. But I&nbsp;have some concerns about the FFM model. In practice,&nbsp;especially when use it in&nbsp;prediction, this model need too many&nbsp;parameters for sparse features. In&nbsp;standard FM model, each sparse feature only has one dense vector of latent factors. &nbsp;But in FFM model, each&nbsp;sparse feature have N(number of feature&nbsp;field) - 1&nbsp;dense vectors to be&nbsp;stored. If both of the&nbsp;dimension of sparse features and number of&nbsp;feature field are big, the&nbsp;storage of the FFM model in single machine will be&nbsp;challenge in model training and online prediction. Do you have any&nbsp;advice for this problem?&nbsp;</p>\n<p>Thanks again!</p>\n<p>[/quote]</p>\n<p>Yes, you are right. The training / prediction time of FFM is usually greater than FM, especially when the number of fields is large. &nbsp;</p>\n<p>However, the difference may not be as large as you think.&nbsp;In my experience, the best number of latent factors (k) for FFM is much smaller than that for FM. For example, if I remember correctly, in Criteo's competition, the best k for FFM is 8, and the best k for FM is 100.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65144",
      "postDate": "02/28/2015 18:27:19",
      "content": "<p>[quote=earthMovingEquipment;65105]</p>\n<p>[quote=guestwalk;64863]</p>\n<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>\n<p>[/quote]</p>\n<p>what purpose of bag features?</p>\n<p>[/quote]</p>\n<p>The concept behind this feature is that if some users have similar app_id (or something else), then these users may have some similarity.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65151",
      "postDate": "02/28/2015 21:44:02",
      "content": "<p>I tried to build LibFFM on Windows, but had to give up and switch to Ubuntu. Install and usage was easy.&nbsp; I could not get it to work on text tokens from longer documents. I guess text tokens do not really have a field (or it should be word order).</p>\n<p>I tried with static fields</p>\n<p>1 0:token_id:1 0:token_id:1 0:token_id:1 0:token_id:1 (seems to take only first token_id for learning)</p>\n<p>and incrementing fields</p>\n<p>1 0:token_id:1 1:token_id:1 2:token_id:1 3:token_id:1 ... n:token_id:1 (first 38 words of document)</p>\n<p>However this field characteristic is still very interesting, I' ll have to try it on other highly dimensional sparse datasets with multiple columns instead of raw text columns (maybe PCA first?).</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65169",
      "postDate": "03/01/2015 07:31:18",
      "content": "<p>[quote=Triskelion;65151]</p>\n<p>I tried to build LibFFM on Windows, but had to give up and switch to Ubuntu. Install and usage was easy.&nbsp; I could not get it to work on text tokens from longer documents. I guess text tokens do not really have a field (or it should be word order).</p>\n<p>I tried with static fields</p>\n<p>1 0:token_id:1 0:token_id:1 0:token_id:1 0:token_id:1 (seems to take only first token_id for learning)</p>\n<p>and incrementing fields</p>\n<p>1 0:token_id:1 1:token_id:1 2:token_id:1 3:token_id:1 ... n:token_id:1 (first 38 words of document)</p>\n<p>However this field characteristic is still very interesting, I' ll have to try it on other highly dimensional sparse datasets with multiple columns instead of raw text columns (maybe PCA first?).</p>\n<p>[/quote]</p>\n<p>Sorry we do not support Windows at this stage. Thanks very much for giving me<br>feedback! I have some ideas:</p>\n<p>1. I don't think your first setting (setting all fields to 0) will work. The<br> reason is that we do not allow interactions within the same field. So<br> basically you are not training anything. If you want to use this setting,<br> you can change</p>\n<p>if(j2 &gt;= model.n || f2 &gt;= model.m || f1 == f2)</p>\n<p>to</p>\n<p>if(j2 &gt;= model.n || f2 &gt;= model.m)</p>\n<p>You can find this code in ffm.cpp. I think it will work. However, because<br> all features are within the same field, FFM reduces to FM in this case.</p>\n<p>2. There is no strong field concepts in document datasets. FFM may not work<br> very well in this kind of dataset..</p>\n<p>3. Did you use ``--norm'' to enable normalization? If not, I suggest you to<br> try it. In my experience with normalization, the result can be much better.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65170",
      "postDate": "03/01/2015 07:36:17",
      "content": "<p>how to convert seamlessly any .csv file into the format of Libffm?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65188",
      "postDate": "03/01/2015 18:00:50",
      "content": "<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65259",
      "postDate": "03/02/2015 16:50:32",
      "content": "<p>[quote=Herimanitra;65170]</p>\n<p>how to convert seamlessly any .csv file into the format of Libffm?</p>\n<p>[/quote]</p>\n<p>We do not have such a tool. Users have to convert from raw data to LIBFFM format by by themselves.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65260",
      "postDate": "03/02/2015 16:51:56",
      "content": "<p>[quote=Mikhail Trofimov;65188]</p>\n<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>\n<p>[/quote]</p>\n<p>I don't know what PITF is. May you provide a reference? Thanks!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65267",
      "postDate": "03/02/2015 17:07:17",
      "content": "<p>[quote=guestwalk;65260]</p>\n<p>[quote=Mikhail Trofimov;65188]</p>\n<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>\n<p>[/quote]</p>\n<p>I don't know what PITF is. May you provide a reference? Thanks!</p>\n<p>[/quote]</p>\n<p>Oh, you are talking about&nbsp;<a href=\"http://www.wsdm-conference.org/2010/proceedings/docs/p81.pdf\">this paper</a>. These two models can be equivalent. This paper is for recommender systems, so there are&nbsp;three fields &quot;user,&quot; &quot;item,&quot; and &quot;tag.&quot; (see equation 12) In FFM we don't have such restriction.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65283",
      "postDate": "03/02/2015 19:35:26",
      "content": "<p>Congratulations..</p>\n<p>Did you change the code a lot since the Criteo version ?<br>I compiled that one to win64 for this competition.<br>Perhaps I could build a Windows version again.<br><br>Also, as a completely non-scientific experiment I also added the term where feature values were multiplied against themselves. (something like (w[jn,fm],w[jn,fm]) xjn*xjn if xn was present for fm.)<br><br>I thought it would be an approximation for the normal SUM(xn&nbsp;* wn)first order terms in the original FM.&nbsp;Halfway the competition I tried it and it gave slightly better results so I kept it in.<br><br>Perhaps you can say something sensible about it. Did you consider adding this term or is it complete non-sense. :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65293",
      "postDate": "03/02/2015 21:09:06",
      "content": "<p>Congratulations and thanks for releasing LIBFFM.</p>\n<p>I looked at the slides, but I'm still not clear what's the difference between FM and FFM. Is it that FFM for each variable have more than one vector of factors (separate vector for each field)?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65324",
      "postDate": "03/03/2015 11:27:31",
      "content": "<p>[quote=Julian de Wit;65283]</p>\n<p>Congratulations..</p>\n<p>Did you change the code a lot since the Criteo version ?<br>I compiled that one to win64 for this competition.<br>Perhaps I could build a Windows version again.<br><br>Also, as a completely non-scientific experiment I also added the term where feature values were multiplied against themselves. (something like (w[jn,fm],w[jn,fm]) xjn*xjn if xn was present for fm.)<br><br>I thought it would be an approximation for the normal SUM(xn&nbsp;* wn)first order terms in the original FM.&nbsp;Halfway the competition I tried it and it gave slightly better results so I kept it in.<br><br>Perhaps you can say something sensible about it. Did you consider adding this term or is it complete non-sense. :)</p>\n<p>[/quote]</p>\n<p>1. For the Windows part: We will make our code compilable on Windows soon. However, we are not planning to release a Windows binary yet.</p>\n<p>2. For the term you added: Yes, I did exactly the same thing before. :)&nbsp; My experiment results was with/without this term make almost no difference, so I do not include this term in LIBFFM.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65334",
      "postDate": "03/03/2015 14:01:21",
      "content": "<p>I'm feeling like libFFM is just another implementation of libFM by just using second order interaction and having a second index for each 'field' and avoid to have an index shifting for different 'fields'.<br><br>But then you have cross-validation build-in and multi-thread more.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65405",
      "postDate": "03/04/2015 12:56:35",
      "content": "<p>HI!<br>Congratulations!<br><br>guestwalk, &nbsp;I have few questions:<br><br>Can you explain why you use exactly this categorical variables<br>,'C14','C17','C20','C21', but not another anonymized&nbsp;categorical variables?<br><br>And also how you find which variables you should use?<br><br>And how did you choose condition for subsetting?<br><br>And also, sorry but I did not find what did you do after hashing? Did you after that use hot-one-encoding of hashed values for get variables or it is already variable for FFM?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65434",
      "postDate": "03/04/2015 20:03:06",
      "content": "<p>@ThierryS,</p>\n<p>FFM is not FM in formulation, algorithm, as well as implementation. You can try to use FM to achieve the same score.</p>\n\n<p>1. Formulation</p>\n<p>In FFM, one feature has distinct vectors to&nbsp;interact with&nbsp;features from different fields while FM assigns one feature only one vector.&nbsp;Conceptually,&nbsp;FFM does not mess&nbsp;interactions between device_ip---app_id and device_ip--app_domain up, but FM does.</p>\n\n<p>2. Algorithm</p>\n<p>Our algorithm is based on our recent research. See the attachement.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65610",
      "postDate": "03/06/2015 16:10:10",
      "content": "<p>Hi, I'm still trying to understand field and index of a feature. My understanding is that given a categorical feature, say device_id, has N unique values, id-1, id-2, .. id-N. So, device_id, is the field and id-i is index. and the value of the corresponding encoded or hashed feature is 0 or 1, indicating the value id-i appears or not in device_id. Am I right? If so, that means all features in the end are binary but how could the example in this&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">slide</a>&nbsp; has numerical features in the end?</p>\n<p>like 1:121:0.3, field:index:value in page 6? Thank you very much.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65715",
      "postDate": "03/08/2015 18:52:43",
      "content": "<p>Hi, there. I am running the bigdata example coming with libffm. What do the features in&nbsp;bigdata.tr.txt mean originally? like the first line,1 0:0:0.3651 2:1163:0.3651 3:8672:0.3651&nbsp;</p>\n<p>What are the field and index standing for in this case? Thank you very much.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65728",
      "postDate": "03/08/2015 21:19:19",
      "content": "<p>[quote=rcarson;65610]</p>\n<p>Hi, I'm still trying to understand field and index of a feature. My understanding is that given a categorical feature, say device_id, has N unique values, id-1, id-2, .. id-N. So, device_id, is the field and id-i is index. and the value of the corresponding encoded or hashed feature is 0 or 1, indicating the value id-i appears or not in device_id. Am I right? If so, that means all features in the end are binary but how could the example in this&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">slide</a>&nbsp; has numerical features in the end?</p>\n<p>like 1:121:0.3, field:index:value in page 6? Thank you very much.</p>\n<p>[/quote]</p>\n<p>I think you can do things like movies_streamed:movie_id:vote&nbsp;dvds_rented:movie_id:vote.</p>\n<p>I use it for when I do not want to onehot encode certain columns with floats. (meta_pred_35,0.4355432) becomes something like 35:0:0.4355432. The index for field 35 is always 0 but the value can differ (and I hope FFM can learn from this).</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65753",
      "postDate": "03/09/2015 05:09:47",
      "content": "<p>@Foxtrot,&nbsp;&nbsp;ThierryS, rcarson</p>\n<p>We understand that the concept of fields is not clear in the slides you checked. We have updated it. There is a concrete example in the <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">updated version</a>. Please check it&nbsp;again. If you still have questions, please re-post your questions and I will reply. Thanks!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65764",
      "postDate": "03/09/2015 09:34:23",
      "content": "<p>Very clear thank you for the update.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65784",
      "postDate": "03/09/2015 15:13:23",
      "content": "<p>[quote=KamilBek;65405]</p>\n<p>HI!<br>Congratulations!<br><br>guestwalk, &nbsp;I have few questions:<br><br>Can you explain why you use exactly this categorical variables<br>,'C14','C17','C20','C21', but not another anonymized&nbsp;categorical variables?<br><br>And also how you find which variables you should use?<br><br>And how did you choose condition for subsetting?<br><br>And also, sorry but I did not find what did you do after hashing? Did you after that use hot-one-encoding of hashed values for get variables or it is already variable for FFM?</p>\n<p>[/quote]</p>\n<p>Thanks. Here are my answers to your questions.</p>\n<p>1. In all following experiments, to measure performance, we use the last day of training data as validation set and the other days as training set.</p>\n<p>2. For variable selection: We select variables by running experiments on a subsampled dataset. The size is 10% of the whole training data. We use all features as a baseline, and if removing a certain feature gives us the same or even better result, then we remove this feature.</p>\n<p>3. For subset:</p>\n<p>a. We first select top 50 or so frequent features. <br> <br> b. We do not consider those anonymized features because we completely have no idea what they are.<br> <br> c. For each feature, we try to run experiments on the subset that contains these feature. If after ensemble there is an improvement, then we add this subset into our model pool.</p>\n<p>4. For the question what we do after hashing: After hashing, we feed the hashed data to FFM. You can find the flowchart on page 5 of <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">these slides</a>.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66007",
      "postDate": "03/12/2015 06:12:57",
      "content": "<p>Congratulations and thanks for your sharing.</p>\n<p>I have one question: if I get it right, FFM only models the interaction between variables. Will the performance be improved if you include the bias term for each variable in the model?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66025",
      "postDate": "03/12/2015 09:05:52",
      "content": "<p>[quote=Jianfeng Zhu;66007]</p>\n<p>Congratulations and thanks for your sharing.</p>\n<p>I have one question: if I get it right, FFM only models the interaction between variables. Will the performance be improved if you include the bias term for each variable in the model?</p>\n<p>[/quote]</p>\n<p>Yes, I have tried this. In my experience adding these terms or not do not<br>affect the loss on the test set a lot. In <a href=\"https://github.com/infinitezxc/kaggle-avazu\">Random Walker's solution</a>&nbsp;they have<br>the linear terms and the result is slight better according to their<br>observation.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "69677",
      "postDate": "04/04/2015 23:46:00",
      "content": "<p>Congratulations to Yu-Chin, Wei-Sheng, Yong and Michael!</p>\n<p>There have been several questions about the relationship between FM and FFM. Here are my thoughts about the differences and similarities.</p>\n<p><strong>Notation</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">m categorical variables (=&quot;fields&quot;)</span></li>\n<li><span style=\"line-height: 1.4\">k is the factorization dimension of FM</span></li>\n<li><span style=\"line-height: 1.4\">k' is the factorization dimension of FFM</span></li>\n</ul>\n<p><strong>Models (slightly simplified)</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FM is defined as</span></li>\n</ul>\n<p><code><span style=\"line-height: 1.4\">&nbsp; &nbsp; &nbsp; y(x) = sum_i sum_j&gt;i &#12296;v_i,v_j&#12297; x_i x_j</span><br></code></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FFM is defined as</span></li>\n</ul>\n<p><code><span style=\"line-height: 1.4\">&nbsp; &nbsp; &nbsp; y(x) = sum_i sum_j&gt;i &#12296;v^J_i,v^I_j&#12297; x_i x_j</span><br></code></p>\n<p>The difference between both models is that FFM assumes that the factors between interactions (e.g. v_i of (I,J) and v_i of (I,L)) are independent whereas FM uses a shared parameter space.</p>\n<p><strong>Number of parameters and costs</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FFM has k' * (m-1) parameters per predictor variable.</span></li>\n<li><span style=\"line-height: 1.4\">FM has k parameters per predictor variable.</span></li>\n<li><span style=\"line-height: 1.4\">FFM has a runtime complexity of k' * m * (m-1) / 2 = O(k' * m^2) per training example</span></li>\n<li><span style=\"line-height: 1.4\">FM has a runtime complexity of k * m = O(k * m) per training example (because the nested sums can be decomposed due to parameter sharing).</span></li>\n</ul>\n<p>That means from a cost point of view, an FFM with dimensionality k' should be compared to an FM with an m times larger dimension, i.e. k=k'*m. With this choice both FFM and FM have the same number of parameters (memory costs) and the same runtime complexity.</p>\n<p><strong>Expressiveness</strong></p>\n<p>FFM and FM have different assumptions on the interaction matrix V. But given a large enough k and k', both can represent any possible second order polynomial model.</p>\n<p>The motivation of FM and FFM is to approximate the (unobserved) pairwise interaction matrix W of polynomial regression by a low rank solution V*V^t = W. FM and FFM have different assumptions how V looks like. FFM assumes that V has a block structure:</p>\n<p><code><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^2_1 &nbsp;v^1_2 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^3_1 &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_3 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^4_1 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_4 &nbsp;0 &nbsp; &nbsp; |<br>V(FFM) = | v^5_1 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_5 |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0 &nbsp; &nbsp; &nbsp;v^3_2 &nbsp;v^2_3 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0 &nbsp; &nbsp; &nbsp;v^4_2 &nbsp;0 &nbsp; &nbsp; &nbsp;v^2_4 &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</code></p>\n<p>FM does not assume such a structure:</p>\n<p><code>V(FM) = | v_1 &nbsp;v_2 &nbsp;v_3 v_4 v_5 |</code></p>\n<p>(Note that v are not scalars but vectors of length k' (for FFM) or of length k (for FM). Also to shorten notation, one entry v in the matrices above represents all the v vectors of a &quot;field&quot;/ categorical variable.)</p>\n<p>If the assumption of FFM holds, then FFM needs less parameters than FM to describe V because FM would need parameters to capture the 0s.</p>\n<p>If the assumption of FM holds, then FM needs less parameters than FFM to describe V because FFM would need to repeat values of vectors as it requires separate parameters.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "69699",
      "postDate": "04/05/2015 08:05:29",
      "content": "<p>In case if somebody is interested I have posted the R slidify presentation about my solution:</p>\n<p>http://mech.math.msu.su/~efimov/2015_04_ICMS_Click/html/index.html#/slide-1</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "69714",
      "postDate": "04/05/2015 15:05:20",
      "content": "<p>@Steffen: Great comments! In my experience even with k = k'*m, FM is usually faster probably because of better memory locality.</p>\n<p>@Dmitry: Very interesting to see the improvement by sorting data with different features.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "71672",
      "postDate": "04/15/2015 09:11:05",
      "content": "<p>Congratulations! Thanks for your sharing the solution. It is a great work!</p>\n<p>I have two questions:</p>\n<p>1)&nbsp;<a href=\"http://www.kaggle.com/c/criteo-display-ad-challenge/forums/t/10555/3-idiots-solution\">&nbsp;The 3 Idiots' solution in criteo</a>&nbsp;includes GBDT to generate additional features which is feed to&nbsp;FFM. But it is omitted &nbsp;in this solution. I guess it is FFM that make most contribution and GBDT help a little to improve the score. &nbsp;Right?</p>\n<p>2) Although both of solutions adapted FFM, the feature engineering methods differ (one use GBDT, the other use bag of words...). What is your basic idea or inspiration to choose different approach?</p>\n<p>Thanks again,</p>\n<p>Steven</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "72040",
      "postDate": "04/17/2015 02:39:01",
      "content": "<p>[quote=LifeMatrix;71672]</p>\n<p>Congratulations! Thanks for your sharing the solution. It is a great work!</p>\n<p>I have two questions:</p>\n<p>1)&nbsp;<a href=\"http://www.kaggle.com/c/criteo-display-ad-challenge/forums/t/10555/3-idiots-solution\">&nbsp;The 3 Idiots' solution in criteo</a>&nbsp;includes GBDT to generate additional features which is feed to&nbsp;FFM. But it is omitted &nbsp;in this solution. I guess it is FFM that make most contribution and GBDT help a little to improve the score. &nbsp;Right?</p>\n<p>2) Although both of solutions adapted FFM, the feature engineering methods differ (one use GBDT, the other use bag of words...). What is your basic idea or inspiration to choose different approach?</p>\n<p>Thanks again,</p>\n<p>Steven</p>\n<p>[/quote]</p>\n<p>Hi Steven,</p>\n<p>For you questions:</p>\n<p>1. The main reason we don't use GBDT in this competition is that there is no numeric features. (Tree based models are conceptually more suitable for numerical features.)</p>\n<p>2. Sorry I do not have a good answer to this question. In my opinion, sometimes feature engineering is just intuition and trial-and-error.</p>\n<p>Yu-Chin</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "74765",
      "postDate": "04/25/2015 22:29:25",
      "content": "<p>You referenced a paper on stochastic gradient descent (mf_adaptive_pakdd.pdf), but it doesn't seem like the libFM uses SGD. Have you thought about implement libFFM using SGD?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "74769",
      "postDate": "04/25/2015 22:54:25",
      "content": "<p>Yeah. We&nbsp;tried it. Our algorithm is exactly a sort of SG but the convergence rate of vanilla SG is slow.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "74777",
      "postDate": "04/26/2015 00:12:31",
      "content": "<p>I haven't gone thru your libFFM code, but I see the double for loop in the train() method, which make me think you are doing direct matrix manipulations. I tried doing it using SGD, but there is fundamental difficulty in the math. If you recall the derivation in Rendle's original paper (see attached), he was able to factor out vi,f from vj,f because i and j are independent. However, in ffm, vi,f is actually vi,fieldof(j),f. So the coefficients can not be separated into distinct summations. In this case, I don't see how you can derive a gradient descent method which is O(N). Would you mind give me an hint?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "74787",
      "postDate": "04/26/2015 01:05:01",
      "content": "<p>The computational complexity per iteration in LIBFFM is not O(N), we do need to go through feature pairs once as their coefficients are independent.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "74788",
      "postDate": "04/26/2015 01:08:06",
      "content": "<p>So, we are in agreement. In fact the complexity is O(N square). That makes it a difficult algorithm to use in production. Except, or course, for features sets of about 10 vectors like in this project, this would&nbsp;not be a factor.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "75819",
      "postDate": "05/01/2015 00:31:05",
      "content": "<p>I am looking over how you selected your features. I already read thru the steps you listed on page 2. Some of the conditions you have in the code are truly bizarre looking. Of course, I have no doubt you had good reasons for choosing them. Here,</p>\n<p>if is_app(row):<br> new_row['pub_id'] = row['app_id']<br> new_row['pub_domain'] = row['app_domain']<br> new_row['pub_category'] = row['app_category']<br> writer_app.writerow(new_row)<br> else:<br> new_row['pub_id'] = row['site_id']<br> new_row['pub_domain'] = row['site_domain']<br> new_row['pub_category'] = row['site_category']<br> writer_site.writerow(new_row)</p>\n<p>You are not subsetting, but rather, you chose app_* over site_* whenever&nbsp;site_id == '85f751fd'. The chosen&nbsp;app_* and site_* values get lumped into the pub_* feature. I really can't imagine what is the reason behind that choice, and why it can lead to better results. Was there a reason for picking&nbsp;85f751fd?</p>\n<p>In another example,&nbsp;</p>\n<p>if int(row['device_ip_count']) &gt; 1000:<br> feats.append(hashstr('device_ip-'+row['device_ip']))<br> else:<br> feats.append(hashstr('device_ip-less-'+row['device_ip_count']))</p>\n<p>You change the hash input value based on the count of some original feature. How were you able to deduce such a threshold even experimentally? Could you give any theoretical basis such a distinction can lead to better prediction?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "75983",
      "postDate": "05/01/2015 22:04:31",
      "content": "<p>[quote=Bruce Ho;74788]</p>\n<p>So, we are in agreement. In fact the complexity is O(N square). That makes it a difficult algorithm to use in production. Except, or course, for features sets of about 10 vectors like in this project, this would&nbsp;not be a factor.</p>\n<p>[/quote]</p>\n<p>It depends. We are very happy to learn the scenario of your production.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "76033",
      "postDate": "05/02/2015 05:22:16",
      "content": "<p>We are still experimenting with our feature set. The number of features should not be huge. However, the data set could easily run into millions, therefore, performance is still a consideration. We are definitely interested in how you picked your features, which we are having a hard time to understand.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "76638",
      "postDate": "05/04/2015 16:52:39",
      "content": "<p>[quote=Bruce Ho;75819]</p>\n<p>I am looking over how you selected your features. I already read thru the steps you listed on page 2. Some of the conditions you have in the code are truly bizarre looking. Of course, I have no doubt you had good reasons for choosing them. Here,</p>\n<p>if is_app(row):<br> new_row['pub_id'] = row['app_id']<br> new_row['pub_domain'] = row['app_domain']<br> new_row['pub_category'] = row['app_category']<br> writer_app.writerow(new_row)<br> else:<br> new_row['pub_id'] = row['site_id']<br> new_row['pub_domain'] = row['site_domain']<br> new_row['pub_category'] = row['site_category']<br> writer_site.writerow(new_row)</p>\n<p>You are not subsetting, but rather, you chose app_* over site_* whenever&nbsp;site_id == '85f751fd'. The chosen&nbsp;app_* and site_* values get lumped into the pub_* feature. I really can't imagine what is the reason behind that choice, and why it can lead to better results. Was there a reason for picking&nbsp;85f751fd?</p>\n<p><span style=\"text-decoration: underline\">We do split the data set (see the different writers). '85f751fd' is considered to be a missing value since it's the most frequent value in this field. Basically, we assume that user behaviors should be different on different platform.</span></p>\n<p>In another example,&nbsp;</p>\n<p>if int(row['device_ip_count']) &gt; 1000:<br> feats.append(hashstr('device_ip-'+row['device_ip']))<br> else:<br> feats.append(hashstr('device_ip-less-'+row['device_ip_count']))</p>\n<p>You change the hash input value based on the count of some original feature. How were you able to deduce such a threshold even experimentally? Could you give any theoretical basis such a distinction can lead to better prediction?</p>\n<p><span style=\"text-decoration: underline\">We have it by experiments; for example, you can select the best one in {10, 100, 1000}. We don't have theoretical explanation. Sorry.</span></p>\n<p>[/quote]</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "76922",
      "postDate": "05/05/2015 04:59:29",
      "content": "<p>I am having some serious questions concerning the way you merge the results of app and site predictions.&nbsp;</p>\n<p>It seems that from the logic in GenData.py, app and site data files are two distinct sets with no overlap due to the filter condition&nbsp;if is_app(row):</p>\n<p>so app files only has rows with site_id &nbsp;=&nbsp;'85f751fd', and the opposite is true for site files. After that two separate models are created for app and site files, generating two sets of predictions. Upon merging of the predictions, the id value from both file types is used to do the merge.</p>\n<p>mprd[key] = logistic_func(sum(map(inv_logistic_func, mprd[key]))/len(mprd[key])) </p>\n\n<p>However, based on the analysis given above there will be no intersection from the two sets at all. Therefor, no averaging is ever done. The only effect is combining the two distinct prediction sets into one.&nbsp;</p>\n<p>I want to make sure I have not missed anything in reaching this conclusion.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "80326",
      "postDate": "05/29/2015 01:23:45",
      "content": "<p>Congrads to the Winner!</p>\n\n<p>I have a question about the variable &quot;history&quot;.</p>\n<p>You showed in the document that you used history like 0,01,011 and so on.</p>\n<p>Did you use the features 0,01,011 as categorical variables? If now, how did you use them?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "115948",
      "postDate": "04/20/2016 23:31:02",
      "content": "<p>Sure this is a basic question here, but can someone explain the expected data format. </p>\n\n<pre><code>&lt;label&gt; &lt;field1&gt;:&lt;index1&gt;:&lt;value1&gt; &lt;field2&gt;:&lt;index2&gt;:&lt;value2&gt;\n</code></pre>\n\n<p>Given a dataset:</p>\n\n<pre><code>Click | Feature1 | Feature2 | Feature3 | \n1     | value    | value    | value    |\n</code></pre>\n\n<p>I understand <code>&lt;index1&gt;</code> would = the column index.</p>\n\n<p>Does <code>&lt;field1&gt;</code> correspond to the row number? </p>\n\n<p>Thanks, </p>",
      "rawMarkdown": "Sure this is a basic question here, but can someone explain the expected data format. \r\n\r\n    <label> <field1>:<index1>:<value1> <field2>:<index2>:<value2>\r\n\r\nGiven a dataset:\r\n\r\n    Click | Feature1 | Feature2 | Feature3 | \r\n    1     | value    | value    | value    |\r\n\r\nI understand `<index1>` would = the column index.\r\n\r\nDoes `<field1>` correspond to the row number? \r\n\r\nThanks,",
      "votes": null
    },
    {
      "id": "129259",
      "postDate": "07/28/2016 03:05:20",
      "content": "<p>@archienorman: This may help you. <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf</a></p>",
      "rawMarkdown": "archienorman: This may help you. http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf",
      "votes": null
    },
    {
      "id": "130087",
      "postDate": "08/03/2016 17:51:38",
      "content": "<p>Hi, \nI am trying to learn your solution and I would like to understand better the additional features that you have used. Can you please explain what do you mean by 'count' and what is the formal definition? By the way, is the PDF slides is the best documentation of your approach or have you write also a paper about your solution?</p>",
      "rawMarkdown": "Hi, \r\nI am trying to learn your solution and I would like to understand better the additional features that you have used. Can you please explain what do you mean by 'count' and what is the formal definition? By the way, is the PDF slides is the best documentation of your approach or have you write also a paper about your solution?",
      "votes": null
    },
    {
      "id": "224416",
      "postDate": "09/26/2017 08:57:37",
      "content": "",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "383594",
      "postDate": "09/09/2018 03:37:44",
      "content": "<p>Good and Thanks!</p>",
      "rawMarkdown": "Good and Thanks!",
      "votes": null
    },
    {
      "id": "673716",
      "postDate": "11/15/2019 11:40:22",
      "content": "<p>Almost no comments in codes of github project libffm. How to read and study it? Thanks.</p>",
      "rawMarkdown": "Almost no comments in codes of github project libffm. How to read and study it? Thanks.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 64865,
      "author_name": "jiweiliu",
      "author_url": "",
      "post_date": "02/25/2015 14:36:59",
      "content": "<p>Thank you very much! I have a question :D &nbsp;Why is the FFM particularly good for this problem? What data structure/characteristic in general is FFM suitable for ? Thank you and congratulations again!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64869,
      "author_name": "inspector",
      "author_url": "",
      "post_date": "02/25/2015 15:11:11",
      "content": "<p>Awesome - thank you for sharing!</p>\n\n<p>One basic question up front : Is a field aware FM the same as a FM (e.g. LIBFM) trained on data set that has a distinct name spaces for every predictor (using 'name space' to mean the role played by this concept in Vowpal Wabbit)? So for example if there were two predictors in a data set:</p>\n<p>A which takes values 'RED' and 'BLUE'</p>\n<p>B which also takes values 'RED' and 'BLUE'</p>\n\n<p>Instead of having data that hashed RED and BLUE to the same value for both A and B, the data would be A_RED or B_RED thus properly treating them as two separate things? Or is there more to it? :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64871,
      "author_name": "triskelion",
      "author_url": "",
      "post_date": "02/25/2015 15:59:02",
      "content": "<p>[quote=rcarson;64865]</p>\n<p>What data structure/characteristic in general is FFM suitable for?</p>\n<p>[/quote]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to <del>3</del> 4 Idiots for releasing LIBFFM. Will play around with it and report back.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64872,
      "author_name": "jiweiliu",
      "author_url": "",
      "post_date": "02/25/2015 16:09:15",
      "content": "<p>[quote=Triskelion;64871]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to 3 Idiots for releasing LIBFFM. Wil play around with it and report back.</p>\n<p>[/quote]</p>\n<p>Thank you very much! That's an excellent paper :D</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64903,
      "author_name": "yejiming",
      "author_url": "",
      "post_date": "02/26/2015 01:41:04",
      "content": "<p>Excellent work indeed!</p>\n<p>And Thanks for the FFM library</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64910,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/26/2015 03:41:17",
      "content": "<p>[quote=rcarson;64872]</p>\n<p>[quote=Triskelion;64871]</p>\n<p>From Rendle's <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">paper</a>: FM work well on datasets with a huge sparsity, like this clicklog dataset, recommender datasets, and&nbsp;also text (bag-of-words).</p>\n<p>Thanks to 3 Idiots for releasing LIBFFM. Wil play around with it and report back.</p>\n<p>[/quote]</p>\n<p>Thank you very much! That's an excellent paper :D</p>\n<p>[/quote]</p>\n<p>Thanks! Here are my opinions for your questions:</p>\n<p>1. As Triskelion has mentioned, I agree with section IV in <a href=\"http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf\">Rendle's paper</a>&nbsp;is a<br> good explanation for the reason why FM-based models can be better than<br> SVM-based models on sparse datasets.</p>\n<p>2. For this question, I have no idea. So far I have only used FFM on CTR<br> datasets. I am also very interested to see if it works on other types of<br> data. That's why we released LIBFFM. :D</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64936,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "02/26/2015 11:52:21",
      "content": "<p>[quote=guestwalk;64863]</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>[/quote]</p>\n<p>Hi, guestwalk,</p>\n<p>Thank you very much for sharing and congratulation! I would like to ask the question about implementation: in stochastic gradient descent (file ffm.cpp, function wTx) you used the update w &nbsp;= w - lr * \\sqrt(1+sum of squares of previous gradients) * gradient. I am wondering why you used this factor&nbsp;\\sqrt(1+sum of squares of previous gradients)? Maybe you could give some links for the description of this idea?</p>\n<p>Dmitry.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64938,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/26/2015 12:08:53",
      "content": "<p>[quote=Dmitry Efimov;64936]</p>\n<p>[quote=guestwalk;64863]</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>[/quote]</p>\n<p>Hi, guestwalk,</p>\n<p>Thank you very much for sharing and congratulation! I would like to ask the question about implementation: in stochastic gradient descent (file ffm.cpp, function wTx) you used the update w &nbsp;= w - lr * \\sqrt(1+sum of squares of previous gradients) * gradient. I am wondering why you used this factor&nbsp;\\sqrt(1+sum of squares of previous gradients)? Maybe you could give some links for the description of this idea?</p>\n<p>Dmitry.</p>\n<p>[/quote]</p>\n<p>Hi Dmitry, this learning-rate schedule is described in our <a href=\"http://www.csie.ntu.edu.tw/~cjlin/papers/libmf/mf_adaptive_pakdd.pdf\">recent paper</a>. Hope it is useful for you.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64943,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "02/26/2015 13:01:00",
      "content": "<p>Great! Thanks!</p>\n<p>One more question, could you explain a little bit more about parameter &quot;v&quot; you are using for prediction? If I understood correctly, you need this parameter to adjust weights only (to avoid them to be very small). Is it correct? Or you need this parameter for something else?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 64999,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/26/2015 22:47:32",
      "content": "<p>[quote=Dmitry Efimov;64943]</p>\n<p>Great! Thanks!</p>\n<p>One more question, could you explain a little bit more about parameter &quot;v&quot; you are using for prediction? If I understood correctly, you need this parameter to adjust weights only (to avoid them to be very small). Is it correct? Or you need this parameter for something else?</p>\n<p>[/quote]</p>\n<p>Sorry I don't quite understand. Do you mean &quot;ffm_float v&quot; in &quot;struct ffm_node&quot;??</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65009,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "02/27/2015 05:15:39",
      "content": "<p>Yes, right! In your previous version it was 2/nr_field. In new version you defined it as&nbsp;2.0f*v1*v2*r in function wTx, file ffm.cpp.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65016,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/27/2015 10:06:07",
      "content": "<p>Okay I see!</p>\n<p>1. &quot;v1&quot; and &quot;v2&quot; respectively are x_j1 and x_j2 in page 6 in <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">this slide</a>.</p>\n<p>2. &quot;r&quot; is the normalization constant, when auto-normalization is not enabled, it is always 1; and if it is enabled, we automatically normalize each instance. For example, if we have x = &quot;1:3:1 2:7:2 3:9:1.5&quot;, and normalization is enabled, then r = 1/sqrt(1*1+2*2+1.5*1.5).</p>\n<p>3. For the constant &quot;2.0f.&quot; Sorry I don't have a good explanation now. Actually FFM still works if this constant is removed, but empirically I find adding this constant makes the convergence faster. One possible reason is that FFM is used to model interactions between features. If we consider polynomial models, for instance, (x1+x2+x3)^2 = x1^2+x2^2+x3^2+2*x1*x2+2*x1*x3+2*x2*x3. The interaction terms have &quot;2&quot; here, so I also have this &quot;2&quot; in FFM.</p>\n<p>Please feel free to let me know if the explanations above are not clear.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65021,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "02/27/2015 11:37:32",
      "content": "<p>Yes, it is clear now, thank you very much! This is really great work!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65052,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/27/2015 17:26:21",
      "content": "<p>[quote=Inspector;64869]</p>\n<p>Awesome - thank you for sharing!</p>\n<p>One basic question up front : Is a field aware FM the same as a FM (e.g. LIBFM) trained on data set that has a distinct name spaces for every predictor (using 'name space' to mean the role played by this concept in Vowpal Wabbit)? So for example if there were two predictors in a data set:</p>\n<p>A which takes values 'RED' and 'BLUE'</p>\n<p>B which also takes values 'RED' and 'BLUE'</p>\n<p>Instead of having data that hashed RED and BLUE to the same value for both A and B, the data would be A_RED or B_RED thus properly treating them as two separate things? Or is there more to it? :)</p>\n<p>[/quote]</p>\n<p>Sorry I still don't quite understand what &quot;name space&quot; is. In your example, my understanding is: &quot;A&quot; and &quot;B&quot; are predictors, and &quot;RED&quot; and &quot;BLUE&quot; are values. Assuming my understanding is correct, in your first question you have the term &quot;name spaces for every predictors.&quot; So in your example, what are namespaces for &quot;A&quot; and &quot;B,&quot; respectively? Thanks! :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65099,
      "author_name": "lynn5234944",
      "author_url": "",
      "post_date": "02/28/2015 03:33:11",
      "content": "<p>Congratulations, thank you for sharing your solution. But I&nbsp;have some concerns about the FFM model. In practice,&nbsp;especially when use it in&nbsp;prediction, this model need too many&nbsp;parameters for sparse features. In&nbsp;standard FM model, each sparse feature only has one dense vector of latent factors. &nbsp;But in FFM model, each&nbsp;sparse feature have N(number of feature&nbsp;field) - 1&nbsp;dense vectors to be&nbsp;stored. If both of the&nbsp;dimension of sparse features and number of&nbsp;feature field are big, the&nbsp;storage of the FFM model in single machine will be&nbsp;challenge in model training and online prediction. Do you have any&nbsp;advice for this problem?&nbsp;</p>\n<p>Thanks again!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65105,
      "author_name": "rowanyuan",
      "author_url": "",
      "post_date": "02/28/2015 05:14:11",
      "content": "<p>[quote=guestwalk;64863]</p>\n<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>\n<p>[/quote]</p>\n\n<p>what purpose of bag features?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65143,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/28/2015 18:22:48",
      "content": "<p>[quote=lynn;65099]</p>\n<p>Congratulations, thank you for sharing your solution. But I&nbsp;have some concerns about the FFM model. In practice,&nbsp;especially when use it in&nbsp;prediction, this model need too many&nbsp;parameters for sparse features. In&nbsp;standard FM model, each sparse feature only has one dense vector of latent factors. &nbsp;But in FFM model, each&nbsp;sparse feature have N(number of feature&nbsp;field) - 1&nbsp;dense vectors to be&nbsp;stored. If both of the&nbsp;dimension of sparse features and number of&nbsp;feature field are big, the&nbsp;storage of the FFM model in single machine will be&nbsp;challenge in model training and online prediction. Do you have any&nbsp;advice for this problem?&nbsp;</p>\n<p>Thanks again!</p>\n<p>[/quote]</p>\n<p>Yes, you are right. The training / prediction time of FFM is usually greater than FM, especially when the number of fields is large. &nbsp;</p>\n<p>However, the difference may not be as large as you think.&nbsp;In my experience, the best number of latent factors (k) for FFM is much smaller than that for FM. For example, if I remember correctly, in Criteo's competition, the best k for FFM is 8, and the best k for FM is 100.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65144,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "02/28/2015 18:27:19",
      "content": "<p>[quote=earthMovingEquipment;65105]</p>\n<p>[quote=guestwalk;64863]</p>\n<p>Dear all,</p>\n<p>We have prepared our <a href=\"https://github.com/guestwalk/kaggle-avazu\">code</a>&nbsp;and <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">document</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge\">Criteo's CTR competition</a>, we find field-aware factorization machine (FFM) is a powerful model. We hope this model can be more widely used, so we also release an implementation&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>. We are very interested to see if it is effective in other kinds of datasets.</p>\n<p>Your questions or comments are welcome! :)</p>\n<p>-- 4 Idiots</p>\n<p>[/quote]</p>\n<p>what purpose of bag features?</p>\n<p>[/quote]</p>\n<p>The concept behind this feature is that if some users have similar app_id (or something else), then these users may have some similarity.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65151,
      "author_name": "triskelion",
      "author_url": "",
      "post_date": "02/28/2015 21:44:02",
      "content": "<p>I tried to build LibFFM on Windows, but had to give up and switch to Ubuntu. Install and usage was easy.&nbsp; I could not get it to work on text tokens from longer documents. I guess text tokens do not really have a field (or it should be word order).</p>\n<p>I tried with static fields</p>\n<p>1 0:token_id:1 0:token_id:1 0:token_id:1 0:token_id:1 (seems to take only first token_id for learning)</p>\n<p>and incrementing fields</p>\n<p>1 0:token_id:1 1:token_id:1 2:token_id:1 3:token_id:1 ... n:token_id:1 (first 38 words of document)</p>\n<p>However this field characteristic is still very interesting, I' ll have to try it on other highly dimensional sparse datasets with multiple columns instead of raw text columns (maybe PCA first?).</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65169,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/01/2015 07:31:18",
      "content": "<p>[quote=Triskelion;65151]</p>\n<p>I tried to build LibFFM on Windows, but had to give up and switch to Ubuntu. Install and usage was easy.&nbsp; I could not get it to work on text tokens from longer documents. I guess text tokens do not really have a field (or it should be word order).</p>\n<p>I tried with static fields</p>\n<p>1 0:token_id:1 0:token_id:1 0:token_id:1 0:token_id:1 (seems to take only first token_id for learning)</p>\n<p>and incrementing fields</p>\n<p>1 0:token_id:1 1:token_id:1 2:token_id:1 3:token_id:1 ... n:token_id:1 (first 38 words of document)</p>\n<p>However this field characteristic is still very interesting, I' ll have to try it on other highly dimensional sparse datasets with multiple columns instead of raw text columns (maybe PCA first?).</p>\n<p>[/quote]</p>\n<p>Sorry we do not support Windows at this stage. Thanks very much for giving me<br>feedback! I have some ideas:</p>\n<p>1. I don't think your first setting (setting all fields to 0) will work. The<br> reason is that we do not allow interactions within the same field. So<br> basically you are not training anything. If you want to use this setting,<br> you can change</p>\n<p>if(j2 &gt;= model.n || f2 &gt;= model.m || f1 == f2)</p>\n<p>to</p>\n<p>if(j2 &gt;= model.n || f2 &gt;= model.m)</p>\n<p>You can find this code in ffm.cpp. I think it will work. However, because<br> all features are within the same field, FFM reduces to FM in this case.</p>\n<p>2. There is no strong field concepts in document datasets. FFM may not work<br> very well in this kind of dataset..</p>\n<p>3. Did you use ``--norm'' to enable normalization? If not, I suggest you to<br> try it. In my experience with normalization, the result can be much better.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65170,
      "author_name": "herimanitra",
      "author_url": "",
      "post_date": "03/01/2015 07:36:17",
      "content": "<p>how to convert seamlessly any .csv file into the format of Libffm?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65188,
      "author_name": "mikhailtrofimov",
      "author_url": "",
      "post_date": "03/01/2015 18:00:50",
      "content": "<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65259,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/02/2015 16:50:32",
      "content": "<p>[quote=Herimanitra;65170]</p>\n<p>how to convert seamlessly any .csv file into the format of Libffm?</p>\n<p>[/quote]</p>\n<p>We do not have such a tool. Users have to convert from raw data to LIBFFM format by by themselves.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65260,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/02/2015 16:51:56",
      "content": "<p>[quote=Mikhail Trofimov;65188]</p>\n<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>\n<p>[/quote]</p>\n<p>I don't know what PITF is. May you provide a reference? Thanks!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65267,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/02/2015 17:07:17",
      "content": "<p>[quote=guestwalk;65260]</p>\n<p>[quote=Mikhail Trofimov;65188]</p>\n<p>Thanks for sharing!</p>\n<p>Can you explain, what is the difference between FFM and PITF?</p>\n<p>[/quote]</p>\n<p>I don't know what PITF is. May you provide a reference? Thanks!</p>\n<p>[/quote]</p>\n<p>Oh, you are talking about&nbsp;<a href=\"http://www.wsdm-conference.org/2010/proceedings/docs/p81.pdf\">this paper</a>. These two models can be equivalent. This paper is for recommender systems, so there are&nbsp;three fields &quot;user,&quot; &quot;item,&quot; and &quot;tag.&quot; (see equation 12) In FFM we don't have such restriction.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65283,
      "author_name": "juliandewit",
      "author_url": "",
      "post_date": "03/02/2015 19:35:26",
      "content": "<p>Congratulations..</p>\n<p>Did you change the code a lot since the Criteo version ?<br>I compiled that one to win64 for this competition.<br>Perhaps I could build a Windows version again.<br><br>Also, as a completely non-scientific experiment I also added the term where feature values were multiplied against themselves. (something like (w[jn,fm],w[jn,fm]) xjn*xjn if xn was present for fm.)<br><br>I thought it would be an approximation for the normal SUM(xn&nbsp;* wn)first order terms in the original FM.&nbsp;Halfway the competition I tried it and it gave slightly better results so I kept it in.<br><br>Perhaps you can say something sensible about it. Did you consider adding this term or is it complete non-sense. :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65293,
      "author_name": "zygmunt",
      "author_url": "",
      "post_date": "03/02/2015 21:09:06",
      "content": "<p>Congratulations and thanks for releasing LIBFFM.</p>\n<p>I looked at the slides, but I'm still not clear what's the difference between FM and FFM. Is it that FFM for each variable have more than one vector of factors (separate vector for each field)?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65324,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/03/2015 11:27:31",
      "content": "<p>[quote=Julian de Wit;65283]</p>\n<p>Congratulations..</p>\n<p>Did you change the code a lot since the Criteo version ?<br>I compiled that one to win64 for this competition.<br>Perhaps I could build a Windows version again.<br><br>Also, as a completely non-scientific experiment I also added the term where feature values were multiplied against themselves. (something like (w[jn,fm],w[jn,fm]) xjn*xjn if xn was present for fm.)<br><br>I thought it would be an approximation for the normal SUM(xn&nbsp;* wn)first order terms in the original FM.&nbsp;Halfway the competition I tried it and it gave slightly better results so I kept it in.<br><br>Perhaps you can say something sensible about it. Did you consider adding this term or is it complete non-sense. :)</p>\n<p>[/quote]</p>\n<p>1. For the Windows part: We will make our code compilable on Windows soon. However, we are not planning to release a Windows binary yet.</p>\n<p>2. For the term you added: Yes, I did exactly the same thing before. :)&nbsp; My experiment results was with/without this term make almost no difference, so I do not include this term in LIBFFM.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65334,
      "author_name": "thierrys",
      "author_url": "",
      "post_date": "03/03/2015 14:01:21",
      "content": "<p>I'm feeling like libFFM is just another implementation of libFM by just using second order interaction and having a second index for each 'field' and avoid to have an index shifting for different 'fields'.<br><br>But then you have cross-validation build-in and multi-thread more.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65405,
      "author_name": "khadiev",
      "author_url": "",
      "post_date": "03/04/2015 12:56:35",
      "content": "<p>HI!<br>Congratulations!<br><br>guestwalk, &nbsp;I have few questions:<br><br>Can you explain why you use exactly this categorical variables<br>,'C14','C17','C20','C21', but not another anonymized&nbsp;categorical variables?<br><br>And also how you find which variables you should use?<br><br>And how did you choose condition for subsetting?<br><br>And also, sorry but I did not find what did you do after hashing? Did you after that use hot-one-encoding of hashed values for get variables or it is already variable for FFM?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65434,
      "author_name": "wschin",
      "author_url": "",
      "post_date": "03/04/2015 20:03:06",
      "content": "<p>@ThierryS,</p>\n<p>FFM is not FM in formulation, algorithm, as well as implementation. You can try to use FM to achieve the same score.</p>\n\n<p>1. Formulation</p>\n<p>In FFM, one feature has distinct vectors to&nbsp;interact with&nbsp;features from different fields while FM assigns one feature only one vector.&nbsp;Conceptually,&nbsp;FFM does not mess&nbsp;interactions between device_ip---app_id and device_ip--app_domain up, but FM does.</p>\n\n<p>2. Algorithm</p>\n<p>Our algorithm is based on our recent research. See the attachement.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65610,
      "author_name": "jiweiliu",
      "author_url": "",
      "post_date": "03/06/2015 16:10:10",
      "content": "<p>Hi, I'm still trying to understand field and index of a feature. My understanding is that given a categorical feature, say device_id, has N unique values, id-1, id-2, .. id-N. So, device_id, is the field and id-i is index. and the value of the corresponding encoded or hashed feature is 0 or 1, indicating the value id-i appears or not in device_id. Am I right? If so, that means all features in the end are binary but how could the example in this&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">slide</a>&nbsp; has numerical features in the end?</p>\n<p>like 1:121:0.3, field:index:value in page 6? Thank you very much.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65715,
      "author_name": "jiweiliu",
      "author_url": "",
      "post_date": "03/08/2015 18:52:43",
      "content": "<p>Hi, there. I am running the bigdata example coming with libffm. What do the features in&nbsp;bigdata.tr.txt mean originally? like the first line,1 0:0:0.3651 2:1163:0.3651 3:8672:0.3651&nbsp;</p>\n<p>What are the field and index standing for in this case? Thank you very much.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65728,
      "author_name": "triskelion",
      "author_url": "",
      "post_date": "03/08/2015 21:19:19",
      "content": "<p>[quote=rcarson;65610]</p>\n<p>Hi, I'm still trying to understand field and index of a feature. My understanding is that given a categorical feature, say device_id, has N unique values, id-1, id-2, .. id-N. So, device_id, is the field and id-i is index. and the value of the corresponding encoded or hashed feature is 0 or 1, indicating the value id-i appears or not in device_id. Am I right? If so, that means all features in the end are binary but how could the example in this&nbsp;<a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">slide</a>&nbsp; has numerical features in the end?</p>\n<p>like 1:121:0.3, field:index:value in page 6? Thank you very much.</p>\n<p>[/quote]</p>\n<p>I think you can do things like movies_streamed:movie_id:vote&nbsp;dvds_rented:movie_id:vote.</p>\n<p>I use it for when I do not want to onehot encode certain columns with floats. (meta_pred_35,0.4355432) becomes something like 35:0:0.4355432. The index for field 35 is always 0 but the value can differ (and I hope FFM can learn from this).</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65753,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/09/2015 05:09:47",
      "content": "<p>@Foxtrot,&nbsp;&nbsp;ThierryS, rcarson</p>\n<p>We understand that the concept of fields is not clear in the slides you checked. We have updated it. There is a concrete example in the <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">updated version</a>. Please check it&nbsp;again. If you still have questions, please re-post your questions and I will reply. Thanks!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65764,
      "author_name": "deepquant",
      "author_url": "",
      "post_date": "03/09/2015 09:34:23",
      "content": "<p>Very clear thank you for the update.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65784,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/09/2015 15:13:23",
      "content": "<p>[quote=KamilBek;65405]</p>\n<p>HI!<br>Congratulations!<br><br>guestwalk, &nbsp;I have few questions:<br><br>Can you explain why you use exactly this categorical variables<br>,'C14','C17','C20','C21', but not another anonymized&nbsp;categorical variables?<br><br>And also how you find which variables you should use?<br><br>And how did you choose condition for subsetting?<br><br>And also, sorry but I did not find what did you do after hashing? Did you after that use hot-one-encoding of hashed values for get variables or it is already variable for FFM?</p>\n<p>[/quote]</p>\n<p>Thanks. Here are my answers to your questions.</p>\n<p>1. In all following experiments, to measure performance, we use the last day of training data as validation set and the other days as training set.</p>\n<p>2. For variable selection: We select variables by running experiments on a subsampled dataset. The size is 10% of the whole training data. We use all features as a baseline, and if removing a certain feature gives us the same or even better result, then we remove this feature.</p>\n<p>3. For subset:</p>\n<p>a. We first select top 50 or so frequent features. <br> <br> b. We do not consider those anonymized features because we completely have no idea what they are.<br> <br> c. For each feature, we try to run experiments on the subset that contains these feature. If after ensemble there is an improvement, then we add this subset into our model pool.</p>\n<p>4. For the question what we do after hashing: After hashing, we feed the hashed data to FFM. You can find the flowchart on page 5 of <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/kaggle-avazu.pdf\">these slides</a>.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66007,
      "author_name": "zhujianfeng",
      "author_url": "",
      "post_date": "03/12/2015 06:12:57",
      "content": "<p>Congratulations and thanks for your sharing.</p>\n<p>I have one question: if I get it right, FFM only models the interaction between variables. Will the performance be improved if you include the bias term for each variable in the model?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66025,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "03/12/2015 09:05:52",
      "content": "<p>[quote=Jianfeng Zhu;66007]</p>\n<p>Congratulations and thanks for your sharing.</p>\n<p>I have one question: if I get it right, FFM only models the interaction between variables. Will the performance be improved if you include the bias term for each variable in the model?</p>\n<p>[/quote]</p>\n<p>Yes, I have tried this. In my experience adding these terms or not do not<br>affect the loss on the test set a lot. In <a href=\"https://github.com/infinitezxc/kaggle-avazu\">Random Walker's solution</a>&nbsp;they have<br>the linear terms and the result is slight better according to their<br>observation.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 69677,
      "author_name": "steffenrendle",
      "author_url": "",
      "post_date": "04/04/2015 23:46:00",
      "content": "<p>Congratulations to Yu-Chin, Wei-Sheng, Yong and Michael!</p>\n<p>There have been several questions about the relationship between FM and FFM. Here are my thoughts about the differences and similarities.</p>\n<p><strong>Notation</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">m categorical variables (=&quot;fields&quot;)</span></li>\n<li><span style=\"line-height: 1.4\">k is the factorization dimension of FM</span></li>\n<li><span style=\"line-height: 1.4\">k' is the factorization dimension of FFM</span></li>\n</ul>\n<p><strong>Models (slightly simplified)</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FM is defined as</span></li>\n</ul>\n<p><code><span style=\"line-height: 1.4\">&nbsp; &nbsp; &nbsp; y(x) = sum_i sum_j&gt;i &#12296;v_i,v_j&#12297; x_i x_j</span><br></code></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FFM is defined as</span></li>\n</ul>\n<p><code><span style=\"line-height: 1.4\">&nbsp; &nbsp; &nbsp; y(x) = sum_i sum_j&gt;i &#12296;v^J_i,v^I_j&#12297; x_i x_j</span><br></code></p>\n<p>The difference between both models is that FFM assumes that the factors between interactions (e.g. v_i of (I,J) and v_i of (I,L)) are independent whereas FM uses a shared parameter space.</p>\n<p><strong>Number of parameters and costs</strong></p>\n<ul>\n<li><span style=\"line-height: 1.4\">FFM has k' * (m-1) parameters per predictor variable.</span></li>\n<li><span style=\"line-height: 1.4\">FM has k parameters per predictor variable.</span></li>\n<li><span style=\"line-height: 1.4\">FFM has a runtime complexity of k' * m * (m-1) / 2 = O(k' * m^2) per training example</span></li>\n<li><span style=\"line-height: 1.4\">FM has a runtime complexity of k * m = O(k * m) per training example (because the nested sums can be decomposed due to parameter sharing).</span></li>\n</ul>\n<p>That means from a cost point of view, an FFM with dimensionality k' should be compared to an FM with an m times larger dimension, i.e. k=k'*m. With this choice both FFM and FM have the same number of parameters (memory costs) and the same runtime complexity.</p>\n<p><strong>Expressiveness</strong></p>\n<p>FFM and FM have different assumptions on the interaction matrix V. But given a large enough k and k', both can represent any possible second order polynomial model.</p>\n<p>The motivation of FM and FFM is to approximate the (unobserved) pairwise interaction matrix W of polynomial regression by a low rank solution V*V^t = W. FM and FFM have different assumptions how V looks like. FFM assumes that V has a block structure:</p>\n<p><code><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^2_1 &nbsp;v^1_2 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^3_1 &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_3 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| v^4_1 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_4 &nbsp;0 &nbsp; &nbsp; |<br>V(FFM) = | v^5_1 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;v^1_5 |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0 &nbsp; &nbsp; &nbsp;v^3_2 &nbsp;v^2_3 &nbsp;0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0 &nbsp; &nbsp; &nbsp;v^4_2 &nbsp;0 &nbsp; &nbsp; &nbsp;v^2_4 &nbsp;0 &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| ... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |</code></p>\n<p>FM does not assume such a structure:</p>\n<p><code>V(FM) = | v_1 &nbsp;v_2 &nbsp;v_3 v_4 v_5 |</code></p>\n<p>(Note that v are not scalars but vectors of length k' (for FFM) or of length k (for FM). Also to shorten notation, one entry v in the matrices above represents all the v vectors of a &quot;field&quot;/ categorical variable.)</p>\n<p>If the assumption of FFM holds, then FFM needs less parameters than FM to describe V because FM would need parameters to capture the 0s.</p>\n<p>If the assumption of FM holds, then FM needs less parameters than FFM to describe V because FFM would need to repeat values of vectors as it requires separate parameters.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 69699,
      "author_name": "efimov",
      "author_url": "",
      "post_date": "04/05/2015 08:05:29",
      "content": "<p>In case if somebody is interested I have posted the R slidify presentation about my solution:</p>\n<p>http://mech.math.msu.su/~efimov/2015_04_ICMS_Click/html/index.html#/slide-1</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 69714,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "04/05/2015 15:05:20",
      "content": "<p>@Steffen: Great comments! In my experience even with k = k'*m, FM is usually faster probably because of better memory locality.</p>\n<p>@Dmitry: Very interesting to see the improvement by sorting data with different features.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 71672,
      "author_name": "lifematrix",
      "author_url": "",
      "post_date": "04/15/2015 09:11:05",
      "content": "<p>Congratulations! Thanks for your sharing the solution. It is a great work!</p>\n<p>I have two questions:</p>\n<p>1)&nbsp;<a href=\"http://www.kaggle.com/c/criteo-display-ad-challenge/forums/t/10555/3-idiots-solution\">&nbsp;The 3 Idiots' solution in criteo</a>&nbsp;includes GBDT to generate additional features which is feed to&nbsp;FFM. But it is omitted &nbsp;in this solution. I guess it is FFM that make most contribution and GBDT help a little to improve the score. &nbsp;Right?</p>\n<p>2) Although both of solutions adapted FFM, the feature engineering methods differ (one use GBDT, the other use bag of words...). What is your basic idea or inspiration to choose different approach?</p>\n<p>Thanks again,</p>\n<p>Steven</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 72040,
      "author_name": "guestwalk",
      "author_url": "",
      "post_date": "04/17/2015 02:39:01",
      "content": "<p>[quote=LifeMatrix;71672]</p>\n<p>Congratulations! Thanks for your sharing the solution. It is a great work!</p>\n<p>I have two questions:</p>\n<p>1)&nbsp;<a href=\"http://www.kaggle.com/c/criteo-display-ad-challenge/forums/t/10555/3-idiots-solution\">&nbsp;The 3 Idiots' solution in criteo</a>&nbsp;includes GBDT to generate additional features which is feed to&nbsp;FFM. But it is omitted &nbsp;in this solution. I guess it is FFM that make most contribution and GBDT help a little to improve the score. &nbsp;Right?</p>\n<p>2) Although both of solutions adapted FFM, the feature engineering methods differ (one use GBDT, the other use bag of words...). What is your basic idea or inspiration to choose different approach?</p>\n<p>Thanks again,</p>\n<p>Steven</p>\n<p>[/quote]</p>\n<p>Hi Steven,</p>\n<p>For you questions:</p>\n<p>1. The main reason we don't use GBDT in this competition is that there is no numeric features. (Tree based models are conceptually more suitable for numerical features.)</p>\n<p>2. Sorry I do not have a good answer to this question. In my opinion, sometimes feature engineering is just intuition and trial-and-error.</p>\n<p>Yu-Chin</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 74765,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "04/25/2015 22:29:25",
      "content": "<p>You referenced a paper on stochastic gradient descent (mf_adaptive_pakdd.pdf), but it doesn't seem like the libFM uses SGD. Have you thought about implement libFFM using SGD?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 74769,
      "author_name": "wschin",
      "author_url": "",
      "post_date": "04/25/2015 22:54:25",
      "content": "<p>Yeah. We&nbsp;tried it. Our algorithm is exactly a sort of SG but the convergence rate of vanilla SG is slow.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 74777,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "04/26/2015 00:12:31",
      "content": "<p>I haven't gone thru your libFFM code, but I see the double for loop in the train() method, which make me think you are doing direct matrix manipulations. I tried doing it using SGD, but there is fundamental difficulty in the math. If you recall the derivation in Rendle's original paper (see attached), he was able to factor out vi,f from vj,f because i and j are independent. However, in ffm, vi,f is actually vi,fieldof(j),f. So the coefficients can not be separated into distinct summations. In this case, I don't see how you can derive a gradient descent method which is O(N). Would you mind give me an hint?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 74787,
      "author_name": "wschin",
      "author_url": "",
      "post_date": "04/26/2015 01:05:01",
      "content": "<p>The computational complexity per iteration in LIBFFM is not O(N), we do need to go through feature pairs once as their coefficients are independent.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 74788,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "04/26/2015 01:08:06",
      "content": "<p>So, we are in agreement. In fact the complexity is O(N square). That makes it a difficult algorithm to use in production. Except, or course, for features sets of about 10 vectors like in this project, this would&nbsp;not be a factor.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 75819,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "05/01/2015 00:31:05",
      "content": "<p>I am looking over how you selected your features. I already read thru the steps you listed on page 2. Some of the conditions you have in the code are truly bizarre looking. Of course, I have no doubt you had good reasons for choosing them. Here,</p>\n<p>if is_app(row):<br> new_row['pub_id'] = row['app_id']<br> new_row['pub_domain'] = row['app_domain']<br> new_row['pub_category'] = row['app_category']<br> writer_app.writerow(new_row)<br> else:<br> new_row['pub_id'] = row['site_id']<br> new_row['pub_domain'] = row['site_domain']<br> new_row['pub_category'] = row['site_category']<br> writer_site.writerow(new_row)</p>\n<p>You are not subsetting, but rather, you chose app_* over site_* whenever&nbsp;site_id == '85f751fd'. The chosen&nbsp;app_* and site_* values get lumped into the pub_* feature. I really can't imagine what is the reason behind that choice, and why it can lead to better results. Was there a reason for picking&nbsp;85f751fd?</p>\n<p>In another example,&nbsp;</p>\n<p>if int(row['device_ip_count']) &gt; 1000:<br> feats.append(hashstr('device_ip-'+row['device_ip']))<br> else:<br> feats.append(hashstr('device_ip-less-'+row['device_ip_count']))</p>\n<p>You change the hash input value based on the count of some original feature. How were you able to deduce such a threshold even experimentally? Could you give any theoretical basis such a distinction can lead to better prediction?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 75983,
      "author_name": "wschin",
      "author_url": "",
      "post_date": "05/01/2015 22:04:31",
      "content": "<p>[quote=Bruce Ho;74788]</p>\n<p>So, we are in agreement. In fact the complexity is O(N square). That makes it a difficult algorithm to use in production. Except, or course, for features sets of about 10 vectors like in this project, this would&nbsp;not be a factor.</p>\n<p>[/quote]</p>\n<p>It depends. We are very happy to learn the scenario of your production.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 76033,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "05/02/2015 05:22:16",
      "content": "<p>We are still experimenting with our feature set. The number of features should not be huge. However, the data set could easily run into millions, therefore, performance is still a consideration. We are definitely interested in how you picked your features, which we are having a hard time to understand.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 76638,
      "author_name": "wschin",
      "author_url": "",
      "post_date": "05/04/2015 16:52:39",
      "content": "<p>[quote=Bruce Ho;75819]</p>\n<p>I am looking over how you selected your features. I already read thru the steps you listed on page 2. Some of the conditions you have in the code are truly bizarre looking. Of course, I have no doubt you had good reasons for choosing them. Here,</p>\n<p>if is_app(row):<br> new_row['pub_id'] = row['app_id']<br> new_row['pub_domain'] = row['app_domain']<br> new_row['pub_category'] = row['app_category']<br> writer_app.writerow(new_row)<br> else:<br> new_row['pub_id'] = row['site_id']<br> new_row['pub_domain'] = row['site_domain']<br> new_row['pub_category'] = row['site_category']<br> writer_site.writerow(new_row)</p>\n<p>You are not subsetting, but rather, you chose app_* over site_* whenever&nbsp;site_id == '85f751fd'. The chosen&nbsp;app_* and site_* values get lumped into the pub_* feature. I really can't imagine what is the reason behind that choice, and why it can lead to better results. Was there a reason for picking&nbsp;85f751fd?</p>\n<p><span style=\"text-decoration: underline\">We do split the data set (see the different writers). '85f751fd' is considered to be a missing value since it's the most frequent value in this field. Basically, we assume that user behaviors should be different on different platform.</span></p>\n<p>In another example,&nbsp;</p>\n<p>if int(row['device_ip_count']) &gt; 1000:<br> feats.append(hashstr('device_ip-'+row['device_ip']))<br> else:<br> feats.append(hashstr('device_ip-less-'+row['device_ip_count']))</p>\n<p>You change the hash input value based on the count of some original feature. How were you able to deduce such a threshold even experimentally? Could you give any theoretical basis such a distinction can lead to better prediction?</p>\n<p><span style=\"text-decoration: underline\">We have it by experiments; for example, you can select the best one in {10, 100, 1000}. We don't have theoretical explanation. Sorry.</span></p>\n<p>[/quote]</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 76922,
      "author_name": "bruceho",
      "author_url": "",
      "post_date": "05/05/2015 04:59:29",
      "content": "<p>I am having some serious questions concerning the way you merge the results of app and site predictions.&nbsp;</p>\n<p>It seems that from the logic in GenData.py, app and site data files are two distinct sets with no overlap due to the filter condition&nbsp;if is_app(row):</p>\n<p>so app files only has rows with site_id &nbsp;=&nbsp;'85f751fd', and the opposite is true for site files. After that two separate models are created for app and site files, generating two sets of predictions. Upon merging of the predictions, the id value from both file types is used to do the merge.</p>\n<p>mprd[key] = logistic_func(sum(map(inv_logistic_func, mprd[key]))/len(mprd[key])) </p>\n\n<p>However, based on the analysis given above there will be no intersection from the two sets at all. Therefor, no averaging is ever done. The only effect is combining the two distinct prediction sets into one.&nbsp;</p>\n<p>I want to make sure I have not missed anything in reaching this conclusion.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 80326,
      "author_name": "pcy1302",
      "author_url": "",
      "post_date": "05/29/2015 01:23:45",
      "content": "<p>Congrads to the Winner!</p>\n\n<p>I have a question about the variable &quot;history&quot;.</p>\n<p>You showed in the document that you used history like 0,01,011 and so on.</p>\n<p>Did you use the features 0,01,011 as categorical variables? If now, how did you use them?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 115948,
      "author_name": "archienorman11",
      "author_url": "",
      "post_date": "04/20/2016 23:31:02",
      "content": "<p>Sure this is a basic question here, but can someone explain the expected data format. </p>\n\n<pre><code>&lt;label&gt; &lt;field1&gt;:&lt;index1&gt;:&lt;value1&gt; &lt;field2&gt;:&lt;index2&gt;:&lt;value2&gt;\n</code></pre>\n\n<p>Given a dataset:</p>\n\n<pre><code>Click | Feature1 | Feature2 | Feature3 | \n1     | value    | value    | value    |\n</code></pre>\n\n<p>I understand <code>&lt;index1&gt;</code> would = the column index.</p>\n\n<p>Does <code>&lt;field1&gt;</code> correspond to the row number? </p>\n\n<p>Thanks, </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 129259,
      "author_name": "trietnm2",
      "author_url": "",
      "post_date": "07/28/2016 03:05:20",
      "content": "<p>@archienorman: This may help you. <a href=\"http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf\">http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 130087,
      "author_name": "hananshteingart",
      "author_url": "",
      "post_date": "08/03/2016 17:51:38",
      "content": "<p>Hi, \nI am trying to learn your solution and I would like to understand better the additional features that you have used. Can you please explain what do you mean by 'count' and what is the formal definition? By the way, is the PDF slides is the best documentation of your approach or have you write also a paper about your solution?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 224416,
      "author_name": "satvik001",
      "author_url": "",
      "post_date": "09/26/2017 08:57:37",
      "content": "",
      "votes": null,
      "replies": []
    },
    {
      "id": 383594,
      "author_name": "cyfei1106",
      "author_url": "",
      "post_date": "09/09/2018 03:37:44",
      "content": "<p>Good and Thanks!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 673716,
      "author_name": "mingxingliu",
      "author_url": "",
      "post_date": "11/15/2019 11:40:22",
      "content": "<p>Almost no comments in codes of github project libffm. How to read and study it? Thanks.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "64863": "",
    "64865": "",
    "64869": "",
    "64871": "",
    "64872": "",
    "64903": "",
    "64910": "",
    "64936": "",
    "64938": "",
    "64943": "",
    "64999": "",
    "65009": "",
    "65016": "",
    "65021": "",
    "65052": "",
    "65099": "",
    "65105": "",
    "65143": "",
    "65144": "",
    "65151": "",
    "65169": "",
    "65170": "",
    "65188": "",
    "65259": "",
    "65260": "",
    "65267": "",
    "65283": "",
    "65293": "",
    "65324": "",
    "65334": "",
    "65405": "",
    "65434": "",
    "65610": "",
    "65715": "",
    "65728": "",
    "65753": "",
    "65764": "",
    "65784": "",
    "66007": "",
    "66025": "",
    "69677": "",
    "69699": "",
    "69714": "",
    "71672": "",
    "72040": "",
    "74765": "",
    "74769": "",
    "74777": "",
    "74787": "",
    "74788": "",
    "75819": "",
    "75983": "",
    "76033": "",
    "76638": "",
    "76922": "",
    "80326": "",
    "115948": "Sure this is a basic question here, but can someone explain the expected data format. \r\n\r\n    <label> <field1>:<index1>:<value1> <field2>:<index2>:<value2>\r\n\r\nGiven a dataset:\r\n\r\n    Click | Feature1 | Feature2 | Feature3 | \r\n    1     | value    | value    | value    |\r\n\r\nI understand `<index1>` would = the column index.\r\n\r\nDoes `<field1>` correspond to the row number? \r\n\r\nThanks,",
    "129259": "archienorman: This may help you. http://www.csie.ntu.edu.tw/~r01922136/slides/ffm.pdf",
    "130087": "Hi, \r\nI am trying to learn your solution and I would like to understand better the additional features that you have used. Can you please explain what do you mean by 'count' and what is the formal definition? By the way, is the PDF slides is the best documentation of your approach or have you write also a paper about your solution?",
    "224416": "",
    "383594": "Good and Thanks!",
    "673716": "Almost no comments in codes of github project libffm. How to read and study it? Thanks."
  },
  "source": "meta"
}