{
  "id": 10555,
  "title": "3 Idiots' Solution & LIBFFM",
  "content": "<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/avazu-ctr-prediction\">Avazu's CTR competition</a>, we find field-aware factorization machines (FFM) are powerful models. We have implemented it in the package <a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>",
  "comments": [
    {
      "id": 578934,
      "author_name": "kapil kumar",
      "author_url": "",
      "post_date": "2019-07-18T10:01:02.703000",
      "content": "<p>Hey I have a little doubt, are the features belonging to same field mutually exclusive or can they occur together.\n for ex. can we have libffm data like 0 1:21:1 1:3:1 1:55:1 ... I tried looking it up online but couldn't find much info. Thanks for help.   </p>",
      "votes": 1,
      "replies": [
        {
          "id": 868746,
          "author_name": "alimeituan",
          "author_url": "",
          "post_date": "2020-05-31T13:07:17.803000",
          "content": "<p>hi,\nI have the same question,\nI just want to some help to transform the CSV to FFM data format ,\ncould you pls help?\nthx</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 55888,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-10T16:17:20.997000",
      "content": "<p>Tianqi:</p>\n<p>Because I do not know how other people used FM, sorry I have no idea about the<br>&quot;difference&quot;. I guess the following three settings might be helpful:</p>\n<p>1. Transforming infrequent features into a special tag. Conceptually, infrequent<br> features should only include very little or even no information, so it<br> should be very hard for a model to extract those information. In fact, these<br> features can be very noisy. We got significant improvement (more than 0.0005)<br> by transforming these features into a special tag.</p>\n<p>2. Transforming numerical features (I1-I13) to categorical features.<br> Empirically we observe using categorical features is always better than<br> using numerical features. However, too many features are generated if<br> numerical features are directly transformed into categorical features, so we<br> use</p>\n<p>v &lt;- floor(log(v)^2)</p>\n<p>to reduce the number of features generated.</p>\n<p>3. Data normalization. According to our empirical experience, instance-wise<br> data normalization makes the optimization problem easier to be solved.<br> For example, for the following vector x</p>\n<p>(0, 0, 1, 1, 0, 1, 0, 1, 0),</p>\n<p>the standard data normalization divides each element of x by by the 2-norm<br> of x. The normalized x becomes</p>\n<p>(0, 0, 0.5, 0.5, 0, 0.5, 0, 0.5, 0).</p>\n<p>The hashing trick do not contribute any improvement on the leaderboard. We<br>apply the hashing trick only because it makes our life easier to generate<br>features. :)</p>",
      "votes": 18,
      "replies": []
    },
    {
      "id": 55796,
      "author_name": "Tianqi Chen",
      "author_url": "",
      "post_date": "2014-10-08T16:18:06.857000",
      "content": "<p>Amazing solution!!&nbsp;Some quick questions:</p>\n<p>(1) What is the impact of using field aware FM and the global latent factor version?</p>\n<p>(2) By LR and FM, do you use features generated by GBDT? Have you measure the impact of the GBDT generated feature?</p>",
      "votes": 9,
      "replies": []
    },
    {
      "id": 59345,
      "author_name": "jwjohnson314",
      "author_url": "",
      "post_date": "2014-12-01T17:13:32.243000",
      "content": "<p>Very nice solution. I'm curious - how did you determine the average CTR's on the public/private leaderboards (slide 16)?</p>",
      "votes": 5,
      "replies": []
    },
    {
      "id": 182484,
      "author_name": "LinLongzhan",
      "author_url": "",
      "post_date": "2017-05-14T04:16:37.237000",
      "content": "<p>我觉得ffm是个很好的主意</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 65763,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2015-03-09T08:25:50.893000",
      "content": "<p>[quote=jwjohnson314;59345]</p>\n<p>Very nice solution. I'm curious - how did you determine the average CTR's on the public/private leaderboards (slide 16)?</p>\n<p>[/quote]</p>\n<p>Suppose we have an impression whose label is 1. If the prediction for this<br>impression is 0, then we should get an infinite logloss. In practice this is<br>not desired, so on the submission system there is a ceiling (C) for logloss.<br>If the logloss for an impression is greater than this ceiling, then it will be<br>truncated. Note that we do not know the value of this ceiling.</p>\n<p>Using this feature, we can hack the average CTR by two submissions.</p>\n<p>The first submission contains all ones, so the logloss we get is P1 =<br>(nr_non_click*C)/nr_instance.</p>\n<p>The second submission contains all zeros, so the logloss we get is P2 =<br>(nr_click*C)/nr_instance.</p>\n<p>We can then get the average CTR = P2/(P1+P2).</p>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 56827,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-27T05:59:10.610000",
      "content": "<p>[quote=Torgos;56807]</p>\n<p>Thank you for posting your solution, but the linked explanation pdf currently returns the error &quot;You don't have permission to access /~r01922136/kaggle-2014-criteo.pdf on this server.&quot;</p>\n<p>[/quote]</p>\n<p>It should be back now. Please try again. Thanks.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 55932,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-11T16:04:12.633000",
      "content": "<p>You are very welcome!</p>\n<p>(2) They are similar but not the same. The FM model in the paper you provided<br> is field unaware. The difference between equation 1 in the paper and the<br> formula on page 14 of our slide is that our w is not only indexed by j1 and<br> j2, but also indexed by f1 and f2. Consider the example on page 15, if<br> Rendle's FM is applied, it becomes:</p>\n<p>w376^Tw248x376x248 + w376^Tw571x376x571 + w376^Tw942x376x942<br> + w248^Tw571x248x571 + w248^Tw942x248x942<br> + w571^Tw942x571x942</p>\n<p>BTW, we use k = 4, not k = 2.</p>\n<p>Please let me know if you have more questions.&nbsp;:)</p>\n<p>[quote=Inspector;55906]</p>\n<p>1) I think this helped a lot. I was confused what the hashing trick was doing. I was thinking perhaps the value of a feature, say 5a9ed9b0, was REPLACED by an integer. So, I understand now that one-hot-encoding is still being used, it is just the indexing of the data which is improved (memory wise) when hashed.</p>\n<p>2) So this is essentially the same model as shown in the Rendle paper http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf (equation 1) , where you used k=2 (the number of factors)? Is this correct?</p>\n<p>Thanks very much!!</p>\n<p>[/quote]</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 55898,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-10T19:21:13.120000",
      "content": "<p>(1) Actually the fact is completely contrary to what you mentioned. We one-hot<br> encode everything. The &quot;integer&quot; you mentioned is actually the index of a<br> feature. For example, consider the feature &quot;C1:5a9ed9b0&quot;, and it is hashed<br> to an integer, say, 872342. It does not mean that a feature's value is<br> 872342; it actually means that the value of 872342nd feature is non-zero.</p>\n<p>(2) Consider the example in the 15th page of the slide. x is an instance of<br> training data, and w is the model. Because x is very sparse, we use sparse<br> format to represent it. That is, only the 376th, the 248th, the 571st, and<br> the 942nd features are non-zero. phi(w,x) can be obtained as the slide<br> shows. So, for your question, x_j1, x_j2, w_j1,f2, and w_j2,f1 are symbols<br> used to represent the corresponding w and x in each term. For example, in<br> the first term, x_j1 is x_376, x_j2 is x_248, w_j1,f2 is w_376,2, and<br> w_j2,f1 is w_248,1.</p>\n<p>Not sure if you think the questions are answered. Please let me know if it is<br>not clear. :)</p>\n<p>[quote=Inspector;55862]</p>\n<p>For those of us (me ;-)) just starting to learn about FM, hope you don't mind a couple elementary questions.</p>\n<p>1) Are you only using numeric variables in the model - no one-hot encoding at all? Everything is hashed to an integer?</p>\n<p><br>2) On Slide #14-15 I am unsure what {x_j1, x_j2 } and {wj1,f2, wj2,f1} are. Would you explain?</p>\n<p>[/quote]</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 55830,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-09T10:49:35.607000",
      "content": "<p>Tianqi:</p>\n<p>(1) We have not submitted one using the global latent factor version. On our validation set, the difference was around 0.001. (Both of them did not use GBDT features.)</p>\n<p>(2) We compare them in the last page of our slide. &quot;FM+GBDT&quot; and &quot;FM&quot; respectively represent training FM with/without adding the GBDT features. We can see the around 0.001 improvement by adding the GBDT features.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 56807,
      "author_name": "Torgos",
      "author_url": "",
      "post_date": "2014-10-26T17:36:41.653000",
      "content": "<p>Thank you for posting your solution, but the linked explanation pdf currently returns the error &quot;You don't have permission to access /~r01922136/kaggle-2014-criteo.pdf on this server.&quot;</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 55966,
      "author_name": "Tianqi Chen",
      "author_url": "",
      "post_date": "2014-10-12T16:15:07.360000",
      "content": "<p>Having to do early stopping seems to be a very common thing that can not be avoided in factorization model. Sometimes using an alternative regularization(e.g max-norm on latent factor) can make the long tail effect comes slower, however it will still come, and the best solution is usually worse than what you can have in optimal iteration.&nbsp;</p>\n<p>Among the factorization models, bayesian version is stable to long-tail effect, however they are not practical(at least not &nbsp;the plain version) because you have to store all the generated samples for prediction.&nbsp;<span style=\"line-height: 1.4\">I have no idea how this can be avoided easily:) Maybe using other stable model to calibrate what is generated from &nbsp;FM models...</span></p>\n<p>The regularization you use appears to be the common one used by MF folks. Since lambda is applied only when nonzero feature occurs. &nbsp;It is not standard L2 regularizer. It is a weighed L2 regularization where weight on feature i is lambda times number of nonzero feature i</p>\n<p>Thanks for answering so many questions! I learned a lot from your solution</p>\n<p>[quote=guestwalk;55952]</p>\n<p>For the questions about the sensitivity and the situation after the best<br>iteration, please see the attachment. (tr_loss and va_loss respectively<br>represent the logloss on the training and the validation set.) I do this on our<br>own validation set; also, I removed GBDT features so that the experiments can<br>run faster.</p>\n<p>We can see the setting eta = 0.1 indeed achieve the best performance on the<br>validation set. For eta = 0.2, eta = 0.05, and eta = 0.02, a similar<br>performance can be achieved. The smaller eta is, the more iterations are<br>required to achieve a good performance; it is the classic SGD behavior. If eta<br>is too large (in this case, 0.5), then the result is significantly worse; for<br>the setting eta = 0.01, it do not converge at 100th iterations. My opinion is<br>choosing a good eta is still crucial to SGD. For a large eta, the accuracy can<br>be hurt; for a small eta, it takes a long time to converge.</p>\n<p>On the other hand, the &quot;long tail&quot; iterations indeed hurts a lot. In fact, we<br>also used this learning rate schedule to solve the simple matrix factorization<br>(MF) problem, and the performance in the long tail iterations is quite stable<br>(i.e., close to the best performance). I think the difference may be that FM is<br>much complicated compared to MF, so the overfitting problem is much harder to<br>be avoided. (In some sense this FM problem is a combination of 39*38/2 MF<br>problem, given there are 39 features for each impression.) This problem is<br>really annoying because it makes our solution less useful in practice. Any<br>suggestion?</p>\n<p>For regularization, our implementation is very simple. Every time we choose an<br>instance, we only update the corresponding coordinate of the non-zero features.<br>For example, if the non-zero coordinates of an instance x are 376, 248, 571,<br>and 942, then only w376, w248, w571, and w942 are updated. Take w248 as an<br>example, the corresponding gradient is</p>\n<p>g248 = lambda*w248 + (the gradient of the loss term)</p>\n<p>Note that lambda is a fixed parameter, we don't change it during training at<br>all. Not sure if it is one of the approaches you mentioned.</p>\n<p>Finally, the gradient of regularization is also accumulated.</p>\n<p>[quote=Tianqi Chen;55931]</p>\n<p>Interesting! This is the first time I see AdaGrad to work on factorization models.</p>\n<p>Sometimes&nbsp;it works great for convex models and some neuralnets. But I wasn't able get it work better than constant learning rate or decayed learning rate on factorization models.</p>\n<p>How sensitive is the result to the initial learning rate, I suspect it is just for lower rate, you run for longer rounds, but still get similar results?</p>\n<p>I get your point about choosing the stopping condition. Since you use AdaGrad, I guess the raising up period after optimal point will be more smoother? Sometimes Adagrad in convex models tends to less overfit, say 50 rounds gets you there, and running for 70 rounds won't hurt too much. I am wondering what is in your case.</p>\n<p>For L2 regularizer, how do you implement it? If it is standard L2 regularizer, you don;t want to regularize parameters every rounds, so either some lazy trick or divide the regularizer by #occurance can be used. In many MF codes, sometimes ppl simply take another regularizer lambda #occraunce_of_fi w_i^2 and run weight decay every time you see the parameter.</p>\n<p>Does the gradient of regularizer goes into the accumulated gradient?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>\n<p>[/quote]</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 55931,
      "author_name": "Tianqi Chen",
      "author_url": "",
      "post_date": "2014-10-11T16:02:50.270000",
      "content": "<p>Interesting! This is the first time I see AdaGrad to work on factorization models.</p>\n<p>Sometimes&nbsp;it works great for convex models and some neuralnets. But I wasn't able get it work better than constant learning rate or decayed learning rate on factorization models.</p>\n<p>How sensitive is the result to the initial learning rate, I suspect it is just for lower rate, you run for longer rounds, but still get similar results?</p>\n<p>I get your point about choosing the stopping condition. Since you use AdaGrad, I guess the raising up period after optimal point will be more smoother? Sometimes Adagrad in convex models tends to less overfit, say 50 rounds gets you there, and running for 70 rounds won't hurt too much. I am wondering what is in your case.</p>\n<p>For L2 regularizer, how do you implement it? If it is standard L2 regularizer, you don;t want to regularize parameters every rounds, so either some lazy trick or divide the regularizer by #occurance can be used. In many MF codes, sometimes ppl simply take another regularizer lambda #occraunce_of_fi w_i^2 and run weight decay every time you see the parameter.</p>\n<p>Does the gradient of regularizer goes into the accumulated gradient?</p>\n<p>Tianqi</p>\n<p>[quote=guestwalk;55930]</p>\n<p>You are very welcome!</p>\n<p>Here are my answers:</p>\n<p>(1) For the weight decay of the learning rate (step size), we use<br> per-coordinate learning rate schedule. For a specific coordinate, the<br> update rule is:</p>\n<p>G = G + g*g<br> <br> w = w - eta*(1/sqrt(G))*g,</p>\n<p>where g is the gradient of that coordinate, G records the accumulated<br> squared sum of the gradients in the past updates, eta is the initial<br> learning rate, and w is the model. Note that the initial value of G is set<br> to 1.<br> <br> This learning rate schedule has been studied in, for example, <a href=\"http://www.magicbroom.info/Papers/DuchiHaSi10.pdf\">this paper</a>.<br> Because we know this learning rate schedule before the competition, we did<br> not spend any time tuning.</p>\n<p>(2) For the value of initial learning rate (eta), we tried 0.5, 0.2, 0.1, 0.05,<br> 0.02, and 0.01 at the early stage we used FM. Then we found that 0.1 is a<br> good balance between the performance and the training time, so we just<br> fixed it and had never changed it.</p>\n<p>Because at that time we haven't included GBDT features, FM ran about three<br> times faster compared to the current setting. These experiments took us<br> around 6 hours.</p>\n<p>(3) For the stopping criterion, we did not find a good one. What we did was:</p>\n<p>1. Run experiments on our validation set, and record the number of<br> iterations to achieve the best performance.<br> <br> 2. Use this number of iterations to train the model on the whole<br> training data.</p>\n<p>So for each of our submissions, we run experiments at least two times: one<br> on validation set and the other on the whole data set.</p>\n<p>(4) There is another parameter need to be tuned: lambda (regularization<br> penalty). Like other machine learning models such as SVM or standard LR,<br> this parameter need to be tuned. We ran experiments very similar to what we<br> mentioned in tuning eta. The time cost of tuning this parameter was also<br> around 6 hours.</p>\n<p>Please feel free to let me know if you have more questions. :)</p>\n<p>[quote=Tianqi Chen;55890]</p>\n<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>\n<p>[/quote]</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 55930,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2014-10-11T15:34:23.923000",
      "content": "<p>You are very welcome!</p>\n<p>Here are my answers:</p>\n<p>(1) For the weight decay of the learning rate (step size), we use<br> per-coordinate learning rate schedule. For a specific coordinate, the<br> update rule is:</p>\n<p>G = G + g*g<br> <br> w = w - eta*(1/sqrt(G))*g,</p>\n<p>where g is the gradient of that coordinate, G records the accumulated<br> squared sum of the gradients in the past updates, eta is the initial<br> learning rate, and w is the model. Note that the initial value of G is set<br> to 1.<br> <br> This learning rate schedule has been studied in, for example, <a href=\"http://www.magicbroom.info/Papers/DuchiHaSi10.pdf\">this paper</a>.<br> Because we know this learning rate schedule before the competition, we did<br> not spend any time tuning.</p>\n<p>(2) For the value of initial learning rate (eta), we tried 0.5, 0.2, 0.1, 0.05,<br> 0.02, and 0.01 at the early stage we used FM. Then we found that 0.1 is a<br> good balance between the performance and the training time, so we just<br> fixed it and had never changed it.</p>\n<p>Because at that time we haven't included GBDT features, FM ran about three<br> times faster compared to the current setting. These experiments took us<br> around 6 hours.</p>\n<p>(3) For the stopping criterion, we did not find a good one. What we did was:</p>\n<p>1. Run experiments on our validation set, and record the number of<br> iterations to achieve the best performance.<br> <br> 2. Use this number of iterations to train the model on the whole<br> training data.</p>\n<p>So for each of our submissions, we run experiments at least two times: one<br> on validation set and the other on the whole data set.</p>\n<p>(4) There is another parameter need to be tuned: lambda (regularization<br> penalty). Like other machine learning models such as SVM or standard LR,<br> this parameter need to be tuned. We ran experiments very similar to what we<br> mentioned in tuning eta. The time cost of tuning this parameter was also<br> around 6 hours.</p>\n<p>Please feel free to let me know if you have more questions. :)</p>\n<p>[quote=Tianqi Chen;55890]</p>\n<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 55890,
      "author_name": "Tianqi Chen",
      "author_url": "",
      "post_date": "2014-10-10T16:35:31.920000",
      "content": "<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[quote=guestwalk;55888]</p>\n<p>Tianqi:</p>\n<p>Because I do not know how other people used FM, sorry I have no idea about the<br>&quot;difference&quot;. I guess the following three settings might be helpful:</p>\n<p>1. Transforming infrequent features into a special tag. Conceptually, infrequent<br> features should only include very little or even no information, so it<br> should be very hard for a model to extract those information. In fact, these<br> features can be very noisy. We got significant improvement (more than 0.0005)<br> by transforming these features into a special tag.</p>\n<p>2. Transforming numerical features (I1-I13) to categorical features.<br> Empirically we observe using categorical features is always better than<br> using numerical features. However, too many features are generated if<br> numerical features are directly transformed into categorical features, so we<br> use</p>\n<p>v &lt;- floor(log(v)^2)</p>\n<p>to reduce the number of features generated.</p>\n<p>3. Data normalization. According to our empirical experience, instance-wise<br> data normalization makes the optimization problem easier to be solved.<br> For example, for the following vector x</p>\n<p>(0, 0, 1, 1, 0, 1, 0, 1, 0),</p>\n<p>the standard data normalization divides each element of x by by the 2-norm<br> of x. The normalized x becomes</p>\n<p>(0, 0, 0.5, 0.5, 0, 0.5, 0, 0.5, 0).</p>\n<p>The hashing trick do not contribute any improvement on the leaderboard. We<br>apply the hashing trick only because it makes our life easier to generate<br>features. :)</p>\n<p>[/quote]</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 55851,
      "author_name": "Tianqi Chen",
      "author_url": "",
      "post_date": "2014-10-09T17:11:34.677000",
      "content": "<p>Thanks for the clarification!! &nbsp;Since a lot of people used FM and I do not think they get to the performance as you do. &nbsp;Can you comment on which part of your method(apart from GBDT features) brings you the difference?</p>\n<p>As far as I can list, this could be parameter tuning, or the Prep-B step you introduced a) changing&nbsp;the less frequent occurred&nbsp;instance to a single tag; b) Hashing trick to limit all the thing to 1M categories; c) The integer remapping techniques</p>\n\n<p>[quote=guestwalk;55830]</p>\n<p>Tianqi:</p>\n<p>(1) We have not submitted one using the global latent factor version. On our validation set, the difference was around 0.001. (Both of them did not use GBDT features.)</p>\n<p>(2) We compare them in the last page of our slide. &quot;FM+GBDT&quot; and &quot;FM&quot; respectively represent training FM with/without adding the GBDT features. We can see the around 0.001 improvement by adding the GBDT features.</p>\n<p>[/quote]</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 3194949,
      "author_name": "xj",
      "author_url": "",
      "post_date": "2025-05-06T13:13:28.103000",
      "content": "<p><a href=\"https://www.kaggle.com/guestwalk\" target=\"_blank\">@guestwalk</a> The link to this document is broken, please do you still have a backup?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 336386,
      "author_name": "Todd Neller",
      "author_url": "",
      "post_date": "2018-05-31T15:56:42.503000",
      "content": "<p>Thank you all for sharing your code and documenting your experiences.  What an excellent education for us all!</p>\n\n<p>In your slides, you note that version2 (v2) has \"50 trees and 8 latent factors\", i.e. the GBDT stage uses 50 trees (compared to 30 in v1), and the FFM stage uses 8 latent factors.  Questions:</p>\n\n<ol>\n<li>Do the 50 trees of v2 also have the same depth 7 as the 30 trees of v1?</li>\n<li>How many latent factors were used with v1's FFM stage?</li>\n</ol>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 180834,
      "author_name": "mylearn",
      "author_url": "",
      "post_date": "2017-05-07T14:09:33.190000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 81530,
      "author_name": "Berber",
      "author_url": "",
      "post_date": "2015-06-10T20:59:14.727000",
      "content": "<p>Hi ! First of all, congrat for the solution,</p>\n<p>in your solution (page 13), i do not really understand what do you mean by CTR in your case . for me you get a CTR by making a &nbsp;threshold on your probability predictions to make decision of click or not and after that you get the CRT which is (# really clicked / # impressions).</p>\n<p>or do you mean that the CTR = mean of your probability predictions ??</p>\n<p>thank you for response&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 66427,
      "author_name": "karlos",
      "author_url": "",
      "post_date": "2015-03-16T18:01:41.773000",
      "content": "<p>Please feel free to fork or send a pull request if there's anything I missed or could be done better.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 66426,
      "author_name": "karlos",
      "author_url": "",
      "post_date": "2015-03-16T18:01:30.637000",
      "content": "<p>I made a couple of small changes so that the code would compile on Cygwin. Project is on github</p>\n<p><a href=\"https://github.com/tadkar/libFFM-1.02-cygwin\">https://github.com/tadkar/libFFM-1.02-cygwin</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 65813,
      "author_name": "mandora",
      "author_url": "",
      "post_date": "2015-03-09T20:44:24.460000",
      "content": "<p>The parameters we used for LibFM:</p>\n<p>solver: als</p>\n<p>number of iteration: 100</p>\n<p>dimension: 1,1,20 (bias on, linear term on, the dimension of latent space is 20)</p>\n<p>regularization coefficient: 0,1,10</p>\n\n<p>[quote=irsneg;57614]</p>\n<p>Hi again!</p>\n<p>I was wondering if you could please share the parameters that you were using with libFM when you guys tried it in your experiments (-learn_rate, -regular, -init_stddev). Thanks!</p>\n<p>[quote=guestwalk;56262]</p>\n<p>Thanks. :) Please see my opinions:</p>\n<p>1. As mentioned on page 14 of our slide, this approach is firstly proposed by<br> Michael Jahrer et al. in KDD Cup 2012 Track 2. In our experiments, this<br> approach is better than the standard FM model. (0.001 - 0.002 improvement)<br> The standard FM shares the same latent space, and the field-aware FM has<br> dedicated latent space for each pair of fields. I think this is the reason<br> why the field-aware FM outperforms the standard FM in this competition.</p>\n<p>2. Sorry I do not quite get what you mean by &quot;simple features&quot;. May you explain<br> more about it?</p>\n<p>3. We tried that, but not including these terms gave us better<br> results. I do not remember what the difference was, so I cannot report a<br> number.</p>\n<p>[quote=irsneg;56198]</p>\n<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 65762,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2015-03-09T08:08:12.977000",
      "content": "<p>[quote=rokh;58729]</p>\n<p>Thanks for such a great solution! Hope you don't mind another little question.<br><br>How and when did you choose threshold for transforming infrequent features?</p>\n<p>[/quote]</p>\n<p>This threshold was selected based on experiments. We tried something like 2, 5, 10, 20, 50, 100, and chose the best one among them.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 65761,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2015-03-09T08:05:14.980000",
      "content": "<p>[quote=wugui;57754]</p>\n<p>congratulations&#65292;i am a newer in competition, please bear with me.</p>\n<p>i have a question about click rate feature.</p>\n<p>because i think click rate feature may be useful for predicting, and i do not find it in your ppt, so i want to know why you don't use click rate feature in your solution?</p>\n<p>[/quote]</p>\n<p>Yes, we tried what you mentioned, but did not get better results.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 65760,
      "author_name": "Yuchin Juan",
      "author_url": "",
      "post_date": "2015-03-09T08:03:59.583000",
      "content": "<p>[quote=clustifier;57412]</p>\n<p>@guestwalk,</p>\n<p>Does&nbsp;special care is needed for generating the gbdt features to avoid overfitting?</p>\n<p>I didn't thought it needed&nbsp;but it looks like I do have some kind of overfitting problem when trying to implement if naively.</p>\n<p>Thanks,</p>\n<p>C.</p>\n<p>[/quote]</p>\n<p>Sorry for the late reply. If you find gbdt overfits, I think reducing the number of trees and the depth of a tree may help.&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 58729,
      "author_name": "rokh",
      "author_url": "",
      "post_date": "2014-11-23T11:55:33.983000",
      "content": "<p>Thanks for such a great solution! Hope you don't mind another little question.<br><br>How and when did you choose threshold for transforming infrequent features?</p>\n\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 58115,
      "author_name": "onthehilluu",
      "author_url": "",
      "post_date": "2014-11-15T16:09:47.273000",
      "content": "<p>Chrome did not work for me to download the paper. But IE or Firefox works.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 58002,
      "author_name": "noooooo",
      "author_url": "",
      "post_date": "2014-11-13T15:55:15.877000",
      "content": "<p>[quote=Rafal Jozefowicz;57996]</p>\n<p>[quote=noooooo;57995]</p>\n<p>Does any one has the pdf of the winner?</p>\n<p>The url has nothing in it rightnow....</p>\n<p>thanks all</p>\n<p>[/quote]</p>\n<p>Opening pdf in chrome incognito mode works for me.</p>\n<p>[/quote]</p>\n<p>thanks, still not work for me, but i use a software to download it :)</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 57996,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-11-13T15:25:13.490000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 57995,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-11-13T15:21:21.243000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 57754,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-11-11T05:39:19.063000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 57614,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-11-10T16:15:57.390000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 57412,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-11-06T16:04:28.657000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56854,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-27T14:15:18.443000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56706,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-25T05:57:39.553000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56356,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-21T21:48:01.993000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56350,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-21T20:08:11.527000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56349,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-21T19:56:55.673000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56305,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-20T23:09:06.797000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56287,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-20T14:01:08.750000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56274,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-20T07:17:10.273000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56273,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-20T05:32:43.947000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56272,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-20T05:30:58.267000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56266,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-19T23:22:44.510000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56264,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-19T19:52:53.797000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56262,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-19T19:12:52.550000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56217,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-18T08:20:10.440000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56198,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-18T06:39:36.077000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56066,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-14T20:13:00.173000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 56009,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-13T09:52:42.617000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 55952,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-12T06:54:36.037000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 55906,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-10T20:59:22.207000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 55862,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-09T22:35:57.823000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 55799,
      "author_name": "",
      "author_url": "",
      "post_date": "2014-10-08T17:28:06.353000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 372895,
      "author_name": "",
      "author_url": "",
      "post_date": "2018-08-20T15:19:06.467000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "comment_count": 57,
  "messages": [
    {
      "id": 55762,
      "postDate": "2014-10-08T07:53:43.963Z",
      "content": "<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>In this competition and <a href=\"https://www.kaggle.com/c/avazu-ctr-prediction\">Avazu's CTR competition</a>, we find field-aware factorization machines (FFM) are powerful models. We have implemented it in the package <a href=\"http://www.csie.ntu.edu.tw/~r01922136/libffm/\">LIBFFM</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>",
      "votes": 71
    },
    {
      "id": 578934,
      "postDate": "2019-07-18T10:01:02.703Z",
      "content": "<p>Hey I have a little doubt, are the features belonging to same field mutually exclusive or can they occur together.\n for ex. can we have libffm data like 0 1:21:1 1:3:1 1:55:1 ... I tried looking it up online but couldn't find much info. Thanks for help.   </p>",
      "rawMarkdown": "Hey I have a little doubt, are the features belonging to same field mutually exclusive or can they occur together.\n for ex. can we have libffm data like 0 1:21:1 1:3:1 1:55:1 ... I tried looking it up online but couldn't find much info. Thanks for help.   ",
      "votes": 1,
      "replies": [
        {
          "id": 868746,
          "postDate": "2020-05-31T13:07:17.803Z",
          "content": "<p>hi,\nI have the same question,\nI just want to some help to transform the CSV to FFM data format ,\ncould you pls help?\nthx</p>",
          "rawMarkdown": "hi,\nI have the same question,\nI just want to some help to transform the CSV to FFM data format ,\ncould you pls help?\nthx"
        }
      ]
    },
    {
      "id": 55888,
      "postDate": "2014-10-10T16:17:20.997Z",
      "content": "<p>Tianqi:</p>\n<p>Because I do not know how other people used FM, sorry I have no idea about the<br>&quot;difference&quot;. I guess the following three settings might be helpful:</p>\n<p>1. Transforming infrequent features into a special tag. Conceptually, infrequent<br> features should only include very little or even no information, so it<br> should be very hard for a model to extract those information. In fact, these<br> features can be very noisy. We got significant improvement (more than 0.0005)<br> by transforming these features into a special tag.</p>\n<p>2. Transforming numerical features (I1-I13) to categorical features.<br> Empirically we observe using categorical features is always better than<br> using numerical features. However, too many features are generated if<br> numerical features are directly transformed into categorical features, so we<br> use</p>\n<p>v &lt;- floor(log(v)^2)</p>\n<p>to reduce the number of features generated.</p>\n<p>3. Data normalization. According to our empirical experience, instance-wise<br> data normalization makes the optimization problem easier to be solved.<br> For example, for the following vector x</p>\n<p>(0, 0, 1, 1, 0, 1, 0, 1, 0),</p>\n<p>the standard data normalization divides each element of x by by the 2-norm<br> of x. The normalized x becomes</p>\n<p>(0, 0, 0.5, 0.5, 0, 0.5, 0, 0.5, 0).</p>\n<p>The hashing trick do not contribute any improvement on the leaderboard. We<br>apply the hashing trick only because it makes our life easier to generate<br>features. :)</p>",
      "votes": 18
    },
    {
      "id": 55796,
      "postDate": "2014-10-08T16:18:06.857Z",
      "content": "<p>Amazing solution!!&nbsp;Some quick questions:</p>\n<p>(1) What is the impact of using field aware FM and the global latent factor version?</p>\n<p>(2) By LR and FM, do you use features generated by GBDT? Have you measure the impact of the GBDT generated feature?</p>",
      "votes": 9
    },
    {
      "id": 59345,
      "postDate": "2014-12-01T17:13:32.243Z",
      "content": "<p>Very nice solution. I'm curious - how did you determine the average CTR's on the public/private leaderboards (slide 16)?</p>",
      "votes": 5
    },
    {
      "id": 182484,
      "postDate": "2017-05-14T04:16:37.237Z",
      "content": "<p>我觉得ffm是个很好的主意</p>",
      "rawMarkdown": "我觉得ffm是个很好的主意"
    },
    {
      "id": 65763,
      "postDate": "2015-03-09T08:25:50.893Z",
      "content": "<p>[quote=jwjohnson314;59345]</p>\n<p>Very nice solution. I'm curious - how did you determine the average CTR's on the public/private leaderboards (slide 16)?</p>\n<p>[/quote]</p>\n<p>Suppose we have an impression whose label is 1. If the prediction for this<br>impression is 0, then we should get an infinite logloss. In practice this is<br>not desired, so on the submission system there is a ceiling (C) for logloss.<br>If the logloss for an impression is greater than this ceiling, then it will be<br>truncated. Note that we do not know the value of this ceiling.</p>\n<p>Using this feature, we can hack the average CTR by two submissions.</p>\n<p>The first submission contains all ones, so the logloss we get is P1 =<br>(nr_non_click*C)/nr_instance.</p>\n<p>The second submission contains all zeros, so the logloss we get is P2 =<br>(nr_click*C)/nr_instance.</p>\n<p>We can then get the average CTR = P2/(P1+P2).</p>",
      "votes": 4
    },
    {
      "id": 56827,
      "postDate": "2014-10-27T05:59:10.610Z",
      "content": "<p>[quote=Torgos;56807]</p>\n<p>Thank you for posting your solution, but the linked explanation pdf currently returns the error &quot;You don't have permission to access /~r01922136/kaggle-2014-criteo.pdf on this server.&quot;</p>\n<p>[/quote]</p>\n<p>It should be back now. Please try again. Thanks.</p>",
      "votes": 3
    },
    {
      "id": 55932,
      "postDate": "2014-10-11T16:04:12.633Z",
      "content": "<p>You are very welcome!</p>\n<p>(2) They are similar but not the same. The FM model in the paper you provided<br> is field unaware. The difference between equation 1 in the paper and the<br> formula on page 14 of our slide is that our w is not only indexed by j1 and<br> j2, but also indexed by f1 and f2. Consider the example on page 15, if<br> Rendle's FM is applied, it becomes:</p>\n<p>w376^Tw248x376x248 + w376^Tw571x376x571 + w376^Tw942x376x942<br> + w248^Tw571x248x571 + w248^Tw942x248x942<br> + w571^Tw942x571x942</p>\n<p>BTW, we use k = 4, not k = 2.</p>\n<p>Please let me know if you have more questions.&nbsp;:)</p>\n<p>[quote=Inspector;55906]</p>\n<p>1) I think this helped a lot. I was confused what the hashing trick was doing. I was thinking perhaps the value of a feature, say 5a9ed9b0, was REPLACED by an integer. So, I understand now that one-hot-encoding is still being used, it is just the indexing of the data which is improved (memory wise) when hashed.</p>\n<p>2) So this is essentially the same model as shown in the Rendle paper http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf (equation 1) , where you used k=2 (the number of factors)? Is this correct?</p>\n<p>Thanks very much!!</p>\n<p>[/quote]</p>",
      "votes": 1
    },
    {
      "id": 55898,
      "postDate": "2014-10-10T19:21:13.120Z",
      "content": "<p>(1) Actually the fact is completely contrary to what you mentioned. We one-hot<br> encode everything. The &quot;integer&quot; you mentioned is actually the index of a<br> feature. For example, consider the feature &quot;C1:5a9ed9b0&quot;, and it is hashed<br> to an integer, say, 872342. It does not mean that a feature's value is<br> 872342; it actually means that the value of 872342nd feature is non-zero.</p>\n<p>(2) Consider the example in the 15th page of the slide. x is an instance of<br> training data, and w is the model. Because x is very sparse, we use sparse<br> format to represent it. That is, only the 376th, the 248th, the 571st, and<br> the 942nd features are non-zero. phi(w,x) can be obtained as the slide<br> shows. So, for your question, x_j1, x_j2, w_j1,f2, and w_j2,f1 are symbols<br> used to represent the corresponding w and x in each term. For example, in<br> the first term, x_j1 is x_376, x_j2 is x_248, w_j1,f2 is w_376,2, and<br> w_j2,f1 is w_248,1.</p>\n<p>Not sure if you think the questions are answered. Please let me know if it is<br>not clear. :)</p>\n<p>[quote=Inspector;55862]</p>\n<p>For those of us (me ;-)) just starting to learn about FM, hope you don't mind a couple elementary questions.</p>\n<p>1) Are you only using numeric variables in the model - no one-hot encoding at all? Everything is hashed to an integer?</p>\n<p><br>2) On Slide #14-15 I am unsure what {x_j1, x_j2 } and {wj1,f2, wj2,f1} are. Would you explain?</p>\n<p>[/quote]</p>",
      "votes": 1
    },
    {
      "id": 55830,
      "postDate": "2014-10-09T10:49:35.607Z",
      "content": "<p>Tianqi:</p>\n<p>(1) We have not submitted one using the global latent factor version. On our validation set, the difference was around 0.001. (Both of them did not use GBDT features.)</p>\n<p>(2) We compare them in the last page of our slide. &quot;FM+GBDT&quot; and &quot;FM&quot; respectively represent training FM with/without adding the GBDT features. We can see the around 0.001 improvement by adding the GBDT features.</p>",
      "votes": 1
    },
    {
      "id": 56807,
      "postDate": "2014-10-26T17:36:41.653Z",
      "content": "<p>Thank you for posting your solution, but the linked explanation pdf currently returns the error &quot;You don't have permission to access /~r01922136/kaggle-2014-criteo.pdf on this server.&quot;</p>",
      "votes": 2
    },
    {
      "id": 55966,
      "postDate": "2014-10-12T16:15:07.360Z",
      "content": "<p>Having to do early stopping seems to be a very common thing that can not be avoided in factorization model. Sometimes using an alternative regularization(e.g max-norm on latent factor) can make the long tail effect comes slower, however it will still come, and the best solution is usually worse than what you can have in optimal iteration.&nbsp;</p>\n<p>Among the factorization models, bayesian version is stable to long-tail effect, however they are not practical(at least not &nbsp;the plain version) because you have to store all the generated samples for prediction.&nbsp;<span style=\"line-height: 1.4\">I have no idea how this can be avoided easily:) Maybe using other stable model to calibrate what is generated from &nbsp;FM models...</span></p>\n<p>The regularization you use appears to be the common one used by MF folks. Since lambda is applied only when nonzero feature occurs. &nbsp;It is not standard L2 regularizer. It is a weighed L2 regularization where weight on feature i is lambda times number of nonzero feature i</p>\n<p>Thanks for answering so many questions! I learned a lot from your solution</p>\n<p>[quote=guestwalk;55952]</p>\n<p>For the questions about the sensitivity and the situation after the best<br>iteration, please see the attachment. (tr_loss and va_loss respectively<br>represent the logloss on the training and the validation set.) I do this on our<br>own validation set; also, I removed GBDT features so that the experiments can<br>run faster.</p>\n<p>We can see the setting eta = 0.1 indeed achieve the best performance on the<br>validation set. For eta = 0.2, eta = 0.05, and eta = 0.02, a similar<br>performance can be achieved. The smaller eta is, the more iterations are<br>required to achieve a good performance; it is the classic SGD behavior. If eta<br>is too large (in this case, 0.5), then the result is significantly worse; for<br>the setting eta = 0.01, it do not converge at 100th iterations. My opinion is<br>choosing a good eta is still crucial to SGD. For a large eta, the accuracy can<br>be hurt; for a small eta, it takes a long time to converge.</p>\n<p>On the other hand, the &quot;long tail&quot; iterations indeed hurts a lot. In fact, we<br>also used this learning rate schedule to solve the simple matrix factorization<br>(MF) problem, and the performance in the long tail iterations is quite stable<br>(i.e., close to the best performance). I think the difference may be that FM is<br>much complicated compared to MF, so the overfitting problem is much harder to<br>be avoided. (In some sense this FM problem is a combination of 39*38/2 MF<br>problem, given there are 39 features for each impression.) This problem is<br>really annoying because it makes our solution less useful in practice. Any<br>suggestion?</p>\n<p>For regularization, our implementation is very simple. Every time we choose an<br>instance, we only update the corresponding coordinate of the non-zero features.<br>For example, if the non-zero coordinates of an instance x are 376, 248, 571,<br>and 942, then only w376, w248, w571, and w942 are updated. Take w248 as an<br>example, the corresponding gradient is</p>\n<p>g248 = lambda*w248 + (the gradient of the loss term)</p>\n<p>Note that lambda is a fixed parameter, we don't change it during training at<br>all. Not sure if it is one of the approaches you mentioned.</p>\n<p>Finally, the gradient of regularization is also accumulated.</p>\n<p>[quote=Tianqi Chen;55931]</p>\n<p>Interesting! This is the first time I see AdaGrad to work on factorization models.</p>\n<p>Sometimes&nbsp;it works great for convex models and some neuralnets. But I wasn't able get it work better than constant learning rate or decayed learning rate on factorization models.</p>\n<p>How sensitive is the result to the initial learning rate, I suspect it is just for lower rate, you run for longer rounds, but still get similar results?</p>\n<p>I get your point about choosing the stopping condition. Since you use AdaGrad, I guess the raising up period after optimal point will be more smoother? Sometimes Adagrad in convex models tends to less overfit, say 50 rounds gets you there, and running for 70 rounds won't hurt too much. I am wondering what is in your case.</p>\n<p>For L2 regularizer, how do you implement it? If it is standard L2 regularizer, you don;t want to regularize parameters every rounds, so either some lazy trick or divide the regularizer by #occurance can be used. In many MF codes, sometimes ppl simply take another regularizer lambda #occraunce_of_fi w_i^2 and run weight decay every time you see the parameter.</p>\n<p>Does the gradient of regularizer goes into the accumulated gradient?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>\n<p>[/quote]</p>",
      "votes": 2
    },
    {
      "id": 55931,
      "postDate": "2014-10-11T16:02:50.270Z",
      "content": "<p>Interesting! This is the first time I see AdaGrad to work on factorization models.</p>\n<p>Sometimes&nbsp;it works great for convex models and some neuralnets. But I wasn't able get it work better than constant learning rate or decayed learning rate on factorization models.</p>\n<p>How sensitive is the result to the initial learning rate, I suspect it is just for lower rate, you run for longer rounds, but still get similar results?</p>\n<p>I get your point about choosing the stopping condition. Since you use AdaGrad, I guess the raising up period after optimal point will be more smoother? Sometimes Adagrad in convex models tends to less overfit, say 50 rounds gets you there, and running for 70 rounds won't hurt too much. I am wondering what is in your case.</p>\n<p>For L2 regularizer, how do you implement it? If it is standard L2 regularizer, you don;t want to regularize parameters every rounds, so either some lazy trick or divide the regularizer by #occurance can be used. In many MF codes, sometimes ppl simply take another regularizer lambda #occraunce_of_fi w_i^2 and run weight decay every time you see the parameter.</p>\n<p>Does the gradient of regularizer goes into the accumulated gradient?</p>\n<p>Tianqi</p>\n<p>[quote=guestwalk;55930]</p>\n<p>You are very welcome!</p>\n<p>Here are my answers:</p>\n<p>(1) For the weight decay of the learning rate (step size), we use<br> per-coordinate learning rate schedule. For a specific coordinate, the<br> update rule is:</p>\n<p>G = G + g*g<br> <br> w = w - eta*(1/sqrt(G))*g,</p>\n<p>where g is the gradient of that coordinate, G records the accumulated<br> squared sum of the gradients in the past updates, eta is the initial<br> learning rate, and w is the model. Note that the initial value of G is set<br> to 1.<br> <br> This learning rate schedule has been studied in, for example, <a href=\"http://www.magicbroom.info/Papers/DuchiHaSi10.pdf\">this paper</a>.<br> Because we know this learning rate schedule before the competition, we did<br> not spend any time tuning.</p>\n<p>(2) For the value of initial learning rate (eta), we tried 0.5, 0.2, 0.1, 0.05,<br> 0.02, and 0.01 at the early stage we used FM. Then we found that 0.1 is a<br> good balance between the performance and the training time, so we just<br> fixed it and had never changed it.</p>\n<p>Because at that time we haven't included GBDT features, FM ran about three<br> times faster compared to the current setting. These experiments took us<br> around 6 hours.</p>\n<p>(3) For the stopping criterion, we did not find a good one. What we did was:</p>\n<p>1. Run experiments on our validation set, and record the number of<br> iterations to achieve the best performance.<br> <br> 2. Use this number of iterations to train the model on the whole<br> training data.</p>\n<p>So for each of our submissions, we run experiments at least two times: one<br> on validation set and the other on the whole data set.</p>\n<p>(4) There is another parameter need to be tuned: lambda (regularization<br> penalty). Like other machine learning models such as SVM or standard LR,<br> this parameter need to be tuned. We ran experiments very similar to what we<br> mentioned in tuning eta. The time cost of tuning this parameter was also<br> around 6 hours.</p>\n<p>Please feel free to let me know if you have more questions. :)</p>\n<p>[quote=Tianqi Chen;55890]</p>\n<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>\n<p>[/quote]</p>",
      "votes": 2
    },
    {
      "id": 55930,
      "postDate": "2014-10-11T15:34:23.923Z",
      "content": "<p>You are very welcome!</p>\n<p>Here are my answers:</p>\n<p>(1) For the weight decay of the learning rate (step size), we use<br> per-coordinate learning rate schedule. For a specific coordinate, the<br> update rule is:</p>\n<p>G = G + g*g<br> <br> w = w - eta*(1/sqrt(G))*g,</p>\n<p>where g is the gradient of that coordinate, G records the accumulated<br> squared sum of the gradients in the past updates, eta is the initial<br> learning rate, and w is the model. Note that the initial value of G is set<br> to 1.<br> <br> This learning rate schedule has been studied in, for example, <a href=\"http://www.magicbroom.info/Papers/DuchiHaSi10.pdf\">this paper</a>.<br> Because we know this learning rate schedule before the competition, we did<br> not spend any time tuning.</p>\n<p>(2) For the value of initial learning rate (eta), we tried 0.5, 0.2, 0.1, 0.05,<br> 0.02, and 0.01 at the early stage we used FM. Then we found that 0.1 is a<br> good balance between the performance and the training time, so we just<br> fixed it and had never changed it.</p>\n<p>Because at that time we haven't included GBDT features, FM ran about three<br> times faster compared to the current setting. These experiments took us<br> around 6 hours.</p>\n<p>(3) For the stopping criterion, we did not find a good one. What we did was:</p>\n<p>1. Run experiments on our validation set, and record the number of<br> iterations to achieve the best performance.<br> <br> 2. Use this number of iterations to train the model on the whole<br> training data.</p>\n<p>So for each of our submissions, we run experiments at least two times: one<br> on validation set and the other on the whole data set.</p>\n<p>(4) There is another parameter need to be tuned: lambda (regularization<br> penalty). Like other machine learning models such as SVM or standard LR,<br> this parameter need to be tuned. We ran experiments very similar to what we<br> mentioned in tuning eta. The time cost of tuning this parameter was also<br> around 6 hours.</p>\n<p>Please feel free to let me know if you have more questions. :)</p>\n<p>[quote=Tianqi Chen;55890]</p>\n<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>",
      "votes": 2
    },
    {
      "id": 55890,
      "postDate": "2014-10-10T16:35:31.920Z",
      "content": "<p>Thanks for detailed answer!</p>\n<p>I like your comment on the data normalization trick. This is also what I observed repeatly in experimenting with factorization models. I think this is mainly because the MF models applies L2 projection and L2 inner product, so keeping the features' L2 norm constant makes different product roughly in the same scale without introducing instance bias.</p>\n<p>Here is another question:) I took a look over your solver and seems it is SGD based solver, so I assume you need to tune the step size and weight decay and do early stopping on validation set? How does the three factors affect your experiment? I guess usually different step size and weight decay could lead to slightly different stoping round.&nbsp;How much effort do you spent on tuning them?</p>\n<p>Tianqi</p>\n<p>[quote=guestwalk;55888]</p>\n<p>Tianqi:</p>\n<p>Because I do not know how other people used FM, sorry I have no idea about the<br>&quot;difference&quot;. I guess the following three settings might be helpful:</p>\n<p>1. Transforming infrequent features into a special tag. Conceptually, infrequent<br> features should only include very little or even no information, so it<br> should be very hard for a model to extract those information. In fact, these<br> features can be very noisy. We got significant improvement (more than 0.0005)<br> by transforming these features into a special tag.</p>\n<p>2. Transforming numerical features (I1-I13) to categorical features.<br> Empirically we observe using categorical features is always better than<br> using numerical features. However, too many features are generated if<br> numerical features are directly transformed into categorical features, so we<br> use</p>\n<p>v &lt;- floor(log(v)^2)</p>\n<p>to reduce the number of features generated.</p>\n<p>3. Data normalization. According to our empirical experience, instance-wise<br> data normalization makes the optimization problem easier to be solved.<br> For example, for the following vector x</p>\n<p>(0, 0, 1, 1, 0, 1, 0, 1, 0),</p>\n<p>the standard data normalization divides each element of x by by the 2-norm<br> of x. The normalized x becomes</p>\n<p>(0, 0, 0.5, 0.5, 0, 0.5, 0, 0.5, 0).</p>\n<p>The hashing trick do not contribute any improvement on the leaderboard. We<br>apply the hashing trick only because it makes our life easier to generate<br>features. :)</p>\n<p>[/quote]</p>",
      "votes": 2
    },
    {
      "id": 55851,
      "postDate": "2014-10-09T17:11:34.677Z",
      "content": "<p>Thanks for the clarification!! &nbsp;Since a lot of people used FM and I do not think they get to the performance as you do. &nbsp;Can you comment on which part of your method(apart from GBDT features) brings you the difference?</p>\n<p>As far as I can list, this could be parameter tuning, or the Prep-B step you introduced a) changing&nbsp;the less frequent occurred&nbsp;instance to a single tag; b) Hashing trick to limit all the thing to 1M categories; c) The integer remapping techniques</p>\n\n<p>[quote=guestwalk;55830]</p>\n<p>Tianqi:</p>\n<p>(1) We have not submitted one using the global latent factor version. On our validation set, the difference was around 0.001. (Both of them did not use GBDT features.)</p>\n<p>(2) We compare them in the last page of our slide. &quot;FM+GBDT&quot; and &quot;FM&quot; respectively represent training FM with/without adding the GBDT features. We can see the around 0.001 improvement by adding the GBDT features.</p>\n<p>[/quote]</p>",
      "votes": 2
    },
    {
      "id": 3194949,
      "postDate": "2025-05-06T13:13:28.103Z",
      "content": "<p><a href=\"https://www.kaggle.com/guestwalk\" target=\"_blank\">@guestwalk</a> The link to this document is broken, please do you still have a backup?</p>",
      "rawMarkdown": "@guestwalk The link to this document is broken, please do you still have a backup?"
    },
    {
      "id": 336386,
      "postDate": "2018-05-31T15:56:42.503Z",
      "content": "<p>Thank you all for sharing your code and documenting your experiences.  What an excellent education for us all!</p>\n\n<p>In your slides, you note that version2 (v2) has \"50 trees and 8 latent factors\", i.e. the GBDT stage uses 50 trees (compared to 30 in v1), and the FFM stage uses 8 latent factors.  Questions:</p>\n\n<ol>\n<li>Do the 50 trees of v2 also have the same depth 7 as the 30 trees of v1?</li>\n<li>How many latent factors were used with v1's FFM stage?</li>\n</ol>",
      "rawMarkdown": "Thank you all for sharing your code and documenting your experiences.  What an excellent education for us all!\n\nIn your slides, you note that version2 (v2) has \"50 trees and 8 latent factors\", i.e. the GBDT stage uses 50 trees (compared to 30 in v1), and the FFM stage uses 8 latent factors.  Questions:\n\n 1. Do the 50 trees of v2 also have the same depth 7 as the 30 trees of v1?\n 2. How many latent factors were used with v1's FFM stage?"
    },
    {
      "id": 180834,
      "postDate": "2017-05-07T14:09:33.190Z",
      "rawMarkdown": ""
    },
    {
      "id": 81530,
      "postDate": "2015-06-10T20:59:14.727Z",
      "content": "<p>Hi ! First of all, congrat for the solution,</p>\n<p>in your solution (page 13), i do not really understand what do you mean by CTR in your case . for me you get a CTR by making a &nbsp;threshold on your probability predictions to make decision of click or not and after that you get the CRT which is (# really clicked / # impressions).</p>\n<p>or do you mean that the CTR = mean of your probability predictions ??</p>\n<p>thank you for response&nbsp;</p>"
    },
    {
      "id": 66427,
      "postDate": "2015-03-16T18:01:41.773Z",
      "content": "<p>Please feel free to fork or send a pull request if there's anything I missed or could be done better.</p>"
    },
    {
      "id": 66426,
      "postDate": "2015-03-16T18:01:30.637Z",
      "content": "<p>I made a couple of small changes so that the code would compile on Cygwin. Project is on github</p>\n<p><a href=\"https://github.com/tadkar/libFFM-1.02-cygwin\">https://github.com/tadkar/libFFM-1.02-cygwin</a></p>"
    },
    {
      "id": 65813,
      "postDate": "2015-03-09T20:44:24.460Z",
      "content": "<p>The parameters we used for LibFM:</p>\n<p>solver: als</p>\n<p>number of iteration: 100</p>\n<p>dimension: 1,1,20 (bias on, linear term on, the dimension of latent space is 20)</p>\n<p>regularization coefficient: 0,1,10</p>\n\n<p>[quote=irsneg;57614]</p>\n<p>Hi again!</p>\n<p>I was wondering if you could please share the parameters that you were using with libFM when you guys tried it in your experiments (-learn_rate, -regular, -init_stddev). Thanks!</p>\n<p>[quote=guestwalk;56262]</p>\n<p>Thanks. :) Please see my opinions:</p>\n<p>1. As mentioned on page 14 of our slide, this approach is firstly proposed by<br> Michael Jahrer et al. in KDD Cup 2012 Track 2. In our experiments, this<br> approach is better than the standard FM model. (0.001 - 0.002 improvement)<br> The standard FM shares the same latent space, and the field-aware FM has<br> dedicated latent space for each pair of fields. I think this is the reason<br> why the field-aware FM outperforms the standard FM in this competition.</p>\n<p>2. Sorry I do not quite get what you mean by &quot;simple features&quot;. May you explain<br> more about it?</p>\n<p>3. We tried that, but not including these terms gave us better<br> results. I do not remember what the difference was, so I cannot report a<br> number.</p>\n<p>[quote=irsneg;56198]</p>\n<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>"
    },
    {
      "id": 65762,
      "postDate": "2015-03-09T08:08:12.977Z",
      "content": "<p>[quote=rokh;58729]</p>\n<p>Thanks for such a great solution! Hope you don't mind another little question.<br><br>How and when did you choose threshold for transforming infrequent features?</p>\n<p>[/quote]</p>\n<p>This threshold was selected based on experiments. We tried something like 2, 5, 10, 20, 50, 100, and chose the best one among them.</p>"
    },
    {
      "id": 65761,
      "postDate": "2015-03-09T08:05:14.980Z",
      "content": "<p>[quote=wugui;57754]</p>\n<p>congratulations&#65292;i am a newer in competition, please bear with me.</p>\n<p>i have a question about click rate feature.</p>\n<p>because i think click rate feature may be useful for predicting, and i do not find it in your ppt, so i want to know why you don't use click rate feature in your solution?</p>\n<p>[/quote]</p>\n<p>Yes, we tried what you mentioned, but did not get better results.</p>"
    },
    {
      "id": 65760,
      "postDate": "2015-03-09T08:03:59.583Z",
      "content": "<p>[quote=clustifier;57412]</p>\n<p>@guestwalk,</p>\n<p>Does&nbsp;special care is needed for generating the gbdt features to avoid overfitting?</p>\n<p>I didn't thought it needed&nbsp;but it looks like I do have some kind of overfitting problem when trying to implement if naively.</p>\n<p>Thanks,</p>\n<p>C.</p>\n<p>[/quote]</p>\n<p>Sorry for the late reply. If you find gbdt overfits, I think reducing the number of trees and the depth of a tree may help.&nbsp;</p>"
    },
    {
      "id": 58729,
      "postDate": "2014-11-23T11:55:33.983Z",
      "content": "<p>Thanks for such a great solution! Hope you don't mind another little question.<br><br>How and when did you choose threshold for transforming infrequent features?</p>\n\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>"
    },
    {
      "id": 58115,
      "postDate": "2014-11-15T16:09:47.273Z",
      "content": "<p>Chrome did not work for me to download the paper. But IE or Firefox works.</p>"
    },
    {
      "id": 58002,
      "postDate": "2014-11-13T15:55:15.877Z",
      "content": "<p>[quote=Rafal Jozefowicz;57996]</p>\n<p>[quote=noooooo;57995]</p>\n<p>Does any one has the pdf of the winner?</p>\n<p>The url has nothing in it rightnow....</p>\n<p>thanks all</p>\n<p>[/quote]</p>\n<p>Opening pdf in chrome incognito mode works for me.</p>\n<p>[/quote]</p>\n<p>thanks, still not work for me, but i use a software to download it :)</p>"
    },
    {
      "id": 57996,
      "postDate": "2014-11-13T15:25:13.490Z",
      "content": "<p>[quote=noooooo;57995]</p>\n<p>Does any one has the pdf of the winner?</p>\n<p>The url has nothing in it rightnow....</p>\n<p>thanks all</p>\n<p>[/quote]</p>\n<p>Opening pdf in chrome incognito mode works for me.</p>"
    },
    {
      "id": 57995,
      "postDate": "2014-11-13T15:21:21.243Z",
      "content": "<p>Does any one has the pdf of the winner?</p>\n<p>The url has nothing in it rightnow....</p>\n<p>thanks all</p>"
    },
    {
      "id": 57754,
      "postDate": "2014-11-11T05:39:19.063Z",
      "content": "<p>congratulations&#65292;i am a newer in competition, please bear with me.</p>\n<p>i have a question about click rate feature.</p>\n<p>because i think click rate feature may be useful for predicting, and i do not find it in your ppt, so i want to know why you don't use click rate feature in your solution?</p>"
    },
    {
      "id": 57614,
      "postDate": "2014-11-10T16:15:57.390Z",
      "content": "<p>Hi again!</p>\n<p>I was wondering if you could please share the parameters that you were using with libFM when you guys tried it in your experiments (-learn_rate, -regular, -init_stddev). Thanks!</p>\n\n<p>[quote=guestwalk;56262]</p>\n<p>Thanks. :) Please see my opinions:</p>\n<p>1. As mentioned on page 14 of our slide, this approach is firstly proposed by<br> Michael Jahrer et al. in KDD Cup 2012 Track 2. In our experiments, this<br> approach is better than the standard FM model. (0.001 - 0.002 improvement)<br> The standard FM shares the same latent space, and the field-aware FM has<br> dedicated latent space for each pair of fields. I think this is the reason<br> why the field-aware FM outperforms the standard FM in this competition.</p>\n<p>2. Sorry I do not quite get what you mean by &quot;simple features&quot;. May you explain<br> more about it?</p>\n<p>3. We tried that, but not including these terms gave us better<br> results. I do not remember what the difference was, so I cannot report a<br> number.</p>\n<p>[quote=irsneg;56198]</p>\n<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>"
    },
    {
      "id": 57412,
      "postDate": "2014-11-06T16:04:28.657Z",
      "content": "<p>@guestwalk,</p>\n<p>Does&nbsp;special care is needed for generating the gbdt features to avoid overfitting?</p>\n<p>I didn't thought it needed&nbsp;but it looks like I do have some kind of overfitting problem when trying to implement if naively.</p>\n<p>Thanks,</p>\n<p>C.</p>"
    },
    {
      "id": 56854,
      "postDate": "2014-10-27T14:15:18.443Z",
      "content": "<p>Thanks; it's working.</p>"
    },
    {
      "id": 56706,
      "postDate": "2014-10-25T05:57:39.553Z",
      "content": "<p>1. Right.</p>\n<p>2. Yes.</p>\n<p>[quote=saurk;56356]</p>\n<p>The 4 tuple (f1,j1,f2, j2) uniquely indexes the parameter dot product, right ? Can we construct a unique 2 tuple &nbsp;(f1__j1, &nbsp;f2_j2) from the given 4 tuple which indexes to the same dot product value ?</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56356,
      "postDate": "2014-10-21T21:48:01.993Z",
      "content": "<p>The 4 tuple (f1,j1,f2, j2) uniquely indexes the parameter dot product, right ? Can we construct a unique 2 tuple &nbsp;(f1__j1, &nbsp;f2_j2) from the given 4 tuple which indexes to the same dot product value ?</p>"
    },
    {
      "id": 56350,
      "postDate": "2014-10-21T20:08:11.527Z",
      "content": "<p>[quote=Inspector;56305]</p>\n<p>I am struggling to see the difference. Are their any tutorials or explanations online you know of that explains field aware FM versus standard FM?</p>\n<p>[/quote]</p>\n<p>The only reference I know is <a href=\"https://storage.googleapis.com/kaggle-competitions/kddcup2012/2748/media/OperaSlides.pdf\">these slides</a>&nbsp;provided by&nbsp;Opera Solutions&nbsp;in KDD Cup 2012. Please check page 11. Though the symbols are quite different from ours, the concept behind is the same.</p>"
    },
    {
      "id": 56349,
      "postDate": "2014-10-21T19:56:55.673Z",
      "content": "<p>No, field-aware FM is nothing to do with hashing collision. For the difference between field-aware FM and standard FM, please see&nbsp;<a href=\"https://www.kaggle.com/c/criteo-display-ad-challenge/forums/t/10555/3-idiots-solution/55932#post55932\">this post</a>.</p>\n<p>[quote=saurk;56287]</p>\n<p>Please correct me if wrong but my understanding was that the reason you introduce field-awareness is because the hashing on feature-pairs result is collision. If the dimensions were much less so there was no need for hashing, would we still use field-aware FMs or thats redundant ?</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56305,
      "postDate": "2014-10-20T23:09:06.797Z",
      "content": "<p>[quote=guestwalk;55932]</p>\n<p>You are very welcome!</p>\n<p>(2) They are similar but not the same. The FM model in the paper you provided<br> is field unaware. The difference between equation 1 in the paper and the<br> formula on page 14 of our slide is that our w is not only indexed by j1 and<br> j2, but also indexed by f1 and f2. Consider the example on page 15, if<br> Rendle's FM is applied, it becomes:</p>\n<p>w376^Tw248x376x248 + w376^Tw571x376x571 + w376^Tw942x376x942<br> + w248^Tw571x248x571 + w248^Tw942x248x942<br> + w571^Tw942x571x942</p>\n<p>[/quote]</p>\n\n<p>I am struggling to see the difference. Are their any tutorials or explanations online you know of that explains field aware FM versus standard FM?</p>"
    },
    {
      "id": 56287,
      "postDate": "2014-10-20T14:01:08.750Z",
      "content": "<p>Please correct me if wrong but my understanding was that the reason you introduce field-awareness is because the hashing on feature-pairs result is collision. If the dimensions were much less so there was no need for hashing, would we still use field-aware FMs or thats redundant ?</p>"
    },
    {
      "id": 56274,
      "postDate": "2014-10-20T07:17:10.273Z",
      "content": "<p>Thanks for the quick response again. You answered all my questions!</p>\n<p>1. OK :).</p>\n<p>2. Oh, that's surprising. So you use only interaction terms; interesting.</p>\n\n<p>[quote=guestwalk;56272]</p>\n<p>You are welcome. :)</p>\n<p>1. Yes. A 0.001 improvement is very significant in this competition.</p>\n<p>2. I see. The same as your previous question (3). We have tried that, but it did not</p>\n<p>give us better result.</p>\n<p>[quote=irsneg;56264]</p>\n<p>Thanks for the quick answer :).</p>\n<p>1. OK, interesting. The improvement is rather marginal though. Is it even significant?</p>\n<p>2. I meant w^T * x from slide 13 (without interaction terms), so that the overall model is with phi(w,x) = w^T * x + sum &lt; w_j1,f1,w_j2,f2&gt; * x_j1 * x_j2 and not only the sum as in the slides, right (I cannot remove the strange =&quot;&quot; which was added automatically...)?</p>\n<p>3. OK.</p>\n<p>[/quote]</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56273,
      "postDate": "2014-10-20T05:32:43.947Z",
      "content": "<p>I do not quite understand what do you mean. May you give a&nbsp;mathematical formulation or an example? Thanks!</p>\n<p>[quote=saurk;56266]</p>\n<p>If we incorporate the field awareness in the feature value itself, say the last two digits of each feature value maps one on one with the source column from which it came, will this FM be same as Rendel's libFM implementation ??</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56272,
      "postDate": "2014-10-20T05:30:58.267Z",
      "content": "<p>You are welcome. :)</p>\n<p>1. Yes. A 0.001 improvement is very significant in this competition.</p>\n<p>2. I see. The same as your previous question (3). We have tried that, but it did not</p>\n<p>give us better result.</p>\n<p>[quote=irsneg;56264]</p>\n<p>Thanks for the quick answer :).</p>\n<p>1. OK, interesting. The improvement is rather marginal though. Is it even significant?</p>\n<p>2. I meant w^T * x from slide 13 (without interaction terms), so that the overall model is with phi(w,x) = w^T * x + sum &lt; w_j1,f1,w_j2,f2&gt; * x_j1 * x_j2 and not only the sum as in the slides, right (I cannot remove the strange =&quot;&quot; which was added automatically...)?</p>\n<p>3. OK.</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56266,
      "postDate": "2014-10-19T23:22:44.510Z",
      "content": "<p>If we incorporate the field awareness in the feature value itself, say the last two digits of each feature value maps one on one with the source column from which it came, will this FM be same as Rendel's libFM implementation ??</p>"
    },
    {
      "id": 56264,
      "postDate": "2014-10-19T19:52:53.797Z",
      "content": "<p>Thanks for the quick answer :).</p>\n<p>1. OK, interesting. The improvement is rather marginal though. Is it even significant?</p>\n<p>2. I meant w^T * x from slide 13 (without interaction terms), so that the overall model is with phi(w,x) = w^T * x + sum &lt; w_j1,f1,w_j2,f2&gt; * x_j1 * x_j2 and not only the sum as in the slides, right (I cannot remove the strange =&quot;&quot; which was added automatically...)?</p>\n<p>3. OK.</p>\n<p>[quote=guestwalk;56262]</p>\n<p>Thanks. :) Please see my opinions:</p>\n<p>1. As mentioned on page 14 of our slide, this approach is firstly proposed by<br> Michael Jahrer et al. in KDD Cup 2012 Track 2. In our experiments, this<br> approach is better than the standard FM model. (0.001 - 0.002 improvement)<br> The standard FM shares the same latent space, and the field-aware FM has<br> dedicated latent space for each pair of fields. I think this is the reason<br> why the field-aware FM outperforms the standard FM in this competition.</p>\n<p>2. Sorry I do not quite get what you mean by &quot;simple features&quot;. May you explain<br> more about it?</p>\n<p>3. We tried that, but not including these terms gave us better<br> results. I do not remember what the difference was, so I cannot report a<br> number.</p>\n<p>[quote=irsneg;56198]</p>\n<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n<p>[/quote]</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56262,
      "postDate": "2014-10-19T19:12:52.550Z",
      "content": "<p>Thanks. :) Please see my opinions:</p>\n<p>1. As mentioned on page 14 of our slide, this approach is firstly proposed by<br> Michael Jahrer et al. in KDD Cup 2012 Track 2. In our experiments, this<br> approach is better than the standard FM model. (0.001 - 0.002 improvement)<br> The standard FM shares the same latent space, and the field-aware FM has<br> dedicated latent space for each pair of fields. I think this is the reason<br> why the field-aware FM outperforms the standard FM in this competition.</p>\n<p>2. Sorry I do not quite get what you mean by &quot;simple features&quot;. May you explain<br> more about it?</p>\n<p>3. We tried that, but not including these terms gave us better<br> results. I do not remember what the difference was, so I cannot report a<br> number.</p>\n<p>[quote=irsneg;56198]</p>\n<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56217,
      "postDate": "2014-10-18T08:20:10.440Z",
      "content": "<p>Sorry for the late reply!</p>\n<p>For your question, I don't think it is a binary classification problem. That<br>is, from some points of view, they are generic; but from some others, they are<br>customized.</p>\n<p>It is generic because the input to these solvers are just a label vector and a<br>matrix. Therefore, for any problem, as long as it can be transformed into the<br>required format, our solvers work.</p>\n<p>On the other hand, it is customized because:</p>\n<p>1. So far we only support binary sparse matrices (sparse matrices whose values<br> are either zero or one). Actually it is not difficult to support generic<br> sparse matrices. Two main reasons we support binary sparse matrices only are<br> that it consumes less memory and that it runs faster.</p>\n<p>2. There are some usability issues. For example, we do not save model, and<br> test set is forced to be specified during training.</p>\n<p>To make these solvers more generic, I think there is still a long way to go.<br>Though it is not difficult to address these issues, it definitely needs some<br>hard works.</p>\n<p>BTW, we just wrote README to introduce the input file formats of GBDT and<br>FM. We are still improving the documents and the codes.</p>\n<p>[quote=saurk;56066]</p>\n<p>Congratulations ! Wondering if the FM and GBDT source code you have here is generic or it's customized to Criteo problem ? &nbsp;If generic, maybe we can use this instead of R or Python's GBM packages.&nbsp;</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56198,
      "postDate": "2014-10-18T06:39:36.077Z",
      "content": "<p>Hi!</p>\n<p>Congrats! Nice and creative approach :). Thanks for sharing and answering all the previous questions; that's very interesting. I have a few addition questions that might interest the community as well; please have a look:</p>\n<p>- How did you come up with this &quot;field-aware&quot; version of FM? Is it performing much better than Rendle's original approach on this problem? Do you have any thoughts on why this is the case?<br>- What are you doing with simple features? (They are not in the formula of phi(w,x) on slide 14)?<br>- Why did not you include interactions terms xj * xj (when j1 == j2 on slide 14)?</p>\n<p>Thanks!</p>\n<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>"
    },
    {
      "id": 56066,
      "postDate": "2014-10-14T20:13:00.173Z",
      "content": "<p>Congratulations ! Wondering if the FM and GBDT source code you have here is generic or it's customized to Criteo problem ? &nbsp;If generic, maybe we can use this instead of R or Python's GBM packages.&nbsp;</p>"
    },
    {
      "id": 56009,
      "postDate": "2014-10-13T09:52:42.617Z",
      "content": "<p>I see. Many thanks for your comments! :)</p>\n<p>[quote=Tianqi Chen;55966]</p>\n<p>Having to do early stopping seems to be a very common thing that can not be avoided in factorization model. Sometimes using an alternative regularization(e.g max-norm on latent factor) can make the long tail effect comes slower, however it will still come, and the best solution is usually worse than what you can have in optimal iteration.&nbsp;</p>\n<p>Among the factorization models, bayesian version is stable to long-tail effect, however they are not practical(at least not &nbsp;the plain version) because you have to store all the generated samples for prediction.&nbsp;<span style=\"line-height: 1.4\">I have no idea how this can be avoided easily:) Maybe using other stable model to calibrate what is generated from &nbsp;FM models...</span></p>\n<p>The regularization you use appears to be the common one used by MF folks. Since lambda is applied only when nonzero feature occurs. &nbsp;It is not standard L2 regularizer. It is a weighed L2 regularization where weight on feature i is lambda times number of nonzero feature i</p>\n<p>Thanks for answering so many questions! I learned a lot from your solution</p>\n<p>[/quote]</p>"
    },
    {
      "id": 55952,
      "postDate": "2014-10-12T06:54:36.037Z",
      "content": "<p>For the questions about the sensitivity and the situation after the best<br>iteration, please see the attachment. (tr_loss and va_loss respectively<br>represent the logloss on the training and the validation set.) I do this on our<br>own validation set; also, I removed GBDT features so that the experiments can<br>run faster.</p>\n<p>We can see the setting eta = 0.1 indeed achieve the best performance on the<br>validation set. For eta = 0.2, eta = 0.05, and eta = 0.02, a similar<br>performance can be achieved. The smaller eta is, the more iterations are<br>required to achieve a good performance; it is the classic SGD behavior. If eta<br>is too large (in this case, 0.5), then the result is significantly worse; for<br>the setting eta = 0.01, it do not converge at 100th iterations. My opinion is<br>choosing a good eta is still crucial to SGD. For a large eta, the accuracy can<br>be hurt; for a small eta, it takes a long time to converge.</p>\n<p>On the other hand, the &quot;long tail&quot; iterations indeed hurts a lot. In fact, we<br>also used this learning rate schedule to solve the simple matrix factorization<br>(MF) problem, and the performance in the long tail iterations is quite stable<br>(i.e., close to the best performance). I think the difference may be that FM is<br>much complicated compared to MF, so the overfitting problem is much harder to<br>be avoided. (In some sense this FM problem is a combination of 39*38/2 MF<br>problem, given there are 39 features for each impression.) This problem is<br>really annoying because it makes our solution less useful in practice. Any<br>suggestion?</p>\n<p>For regularization, our implementation is very simple. Every time we choose an<br>instance, we only update the corresponding coordinate of the non-zero features.<br>For example, if the non-zero coordinates of an instance x are 376, 248, 571,<br>and 942, then only w376, w248, w571, and w942 are updated. Take w248 as an<br>example, the corresponding gradient is</p>\n<p>g248 = lambda*w248 + (the gradient of the loss term)</p>\n<p>Note that lambda is a fixed parameter, we don't change it during training at<br>all. Not sure if it is one of the approaches you mentioned.</p>\n<p>Finally, the gradient of regularization is also accumulated.</p>\n<p>[quote=Tianqi Chen;55931]</p>\n<p>Interesting! This is the first time I see AdaGrad to work on factorization models.</p>\n<p>Sometimes&nbsp;it works great for convex models and some neuralnets. But I wasn't able get it work better than constant learning rate or decayed learning rate on factorization models.</p>\n<p>How sensitive is the result to the initial learning rate, I suspect it is just for lower rate, you run for longer rounds, but still get similar results?</p>\n<p>I get your point about choosing the stopping condition. Since you use AdaGrad, I guess the raising up period after optimal point will be more smoother? Sometimes Adagrad in convex models tends to less overfit, say 50 rounds gets you there, and running for 70 rounds won't hurt too much. I am wondering what is in your case.</p>\n<p>For L2 regularizer, how do you implement it? If it is standard L2 regularizer, you don;t want to regularize parameters every rounds, so either some lazy trick or divide the regularizer by #occurance can be used. In many MF codes, sometimes ppl simply take another regularizer lambda #occraunce_of_fi w_i^2 and run weight decay every time you see the parameter.</p>\n<p>Does the gradient of regularizer goes into the accumulated gradient?</p>\n<p>Tianqi</p>\n<p>[/quote]</p>"
    },
    {
      "id": 55906,
      "postDate": "2014-10-10T20:59:22.207Z",
      "content": "<p>[quote=guestwalk;55898]</p>\n<p>Not sure if you think the questions are answered. Please let me know if it is<br>not clear. :)</p>\n<p>[/quote]</p>\n\n<p>1) I think this helped a lot. I was confused what the hashing trick was doing. I was thinking perhaps the value of a feature, say 5a9ed9b0, was REPLACED by an integer. So, I understand now that one-hot-encoding is still being used, it is just the indexing of the data which is improved (memory wise) when hashed.</p>\n\n<p>2) So this is essentially the same model as shown in the Rendle paper http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle2010FM.pdf (equation 1) , where you used k=2 (the number of factors)? Is this correct?</p>\n\n<p>Thanks very much!!</p>"
    },
    {
      "id": 55862,
      "postDate": "2014-10-09T22:35:57.823Z",
      "content": "<p>[quote=guestwalk;55762]</p>\n<p>Dear all,</p>\n<p>We have prepared our codes and documents.</p>\n<p>For the codes, please see <a href=\"https://github.com/guestwalk/kaggle-2014-criteo\">here</a>; and for the documents, please see <a href=\"http://www.csie.ntu.edu.tw/~r01922136/kaggle-2014-criteo.pdf\">here</a>.</p>\n<p>Your comments are very welcome. Thanks!</p>\n<p>-- 3 Idiots</p>\n<p>[/quote]</p>\n\n\n<p>For those of us (me ;-)) just starting to learn about FM, hope you don't mind a couple elementary questions.</p>\n<p>1) Are you only using numeric variables in the model - no one-hot encoding at all? Everything is hashed to an integer?</p>\n<p><br>2) On Slide #14-15 I am unsure what {x_j1, x_j2 } and {wj1,f2, wj2,f1} are. Would you explain?</p>"
    },
    {
      "id": 55799,
      "postDate": "2014-10-08T17:28:06.353Z",
      "content": "<p>Excellent job! This is about innovation. Deep learners claim that GBDT having 3-level of depth. (linear models have 1 level. others with nonlinear feature generation have depth of 2 such as polynomial kernel, decision tree). I thought how about using GBDT for feature generation before, but didn't get workable ideas. BTW, C11 looks nicer.&nbsp;</p>"
    },
    {
      "id": 372895,
      "postDate": "2018-08-20T15:19:06.467Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T14:44:23Z",
  "competition_id": 3934,
  "competition_slug": "criteo-display-ad-challenge",
  "team_id": 111677,
  "solution_url": "/competitions/criteo-display-ad-challenge/writeups/3-idiots-3-idiots-solution-libffm"
}