{
  "id": 7917,
  "title": "Performance of Logistic Regression on Features Described by Triskelion ",
  "url": "/competitions/acquire-valued-shoppers-challenge/discussion/7917",
  "author_name": "",
  "post_date": "2014-04-29T04:25:59.650Z",
  "votes": 2,
  "comment_count": 45,
  "views": 20400,
  "content": "<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>",
  "messages": [
    {
      "id": "43265",
      "postDate": "04/29/2014 04:25:59",
      "content": "<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "43307",
      "postDate": "04/29/2014 15:45:55",
      "content": "<p>Yes, VW does some magic. &nbsp;It uses <a href=\"http://en.wikipedia.org/wiki/Stochastic_gradient_descent\">stochastic gradient descent</a>, which is a little less sensitive to outliers. &nbsp;The code you linked to also uses <a href=\"http://en.wikipedia.org/wiki/Quantile_regression\">quantile regression</a>, rather than logistic regression, which seems to give better results on this dataset. &nbsp;I haven't figured out why they use a quantile_tau of 0.60 rather than the median, but that magic number also seems to give better results on this dataset.</p>\n<p>Finally, it's possible that the featureset you built yourself is different from the one built in the linked post. &nbsp;Check your subsets and aggregations carefully!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "44415",
      "postDate": "05/12/2014 16:43:49",
      "content": "<p>If you want to use another tool, bear in mind that vw has a couple of features on by default&nbsp;that may or may not be implemented (e.g., adaptive, normalized, invariant update rules / using holdout data to determine how many passes you need&nbsp;/ ...)</p>\n<p>Here is a very brief description of what it does: https://github.com/JohnLangford/vowpal_wabbit/wiki/Command-line-arguments</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "47261",
      "postDate": "05/29/2014 14:35:21",
      "content": "<p>What percentage of repeaters classifies the model right?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48814",
      "postDate": "06/07/2014 00:07:57",
      "content": "<p>How can quantile regression be used on a binomial problem?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48824",
      "postDate": "06/07/2014 09:30:16",
      "content": "<p>[quote=Upul Bandara;43265]</p>\n<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>\n<p>[/quote]</p>\n<p>I tried R package glmnet(alpha = 0, lambda = 2^17, family = &quot;binomial&quot;) on the&nbsp;Triskelion's features except&nbsp;offer_quantity and got&nbsp;0.59565. The reason for the difference between Upul's score and mine may be the parameter estimation method employed by glmnet. See&nbsp;<a href=\"http://www.stanford.edu/~hastie/Papers/glmnet.pdf\">Regularization Paths for Generalized Linear Models via Coordinate Descent</a>&nbsp;in detail.<br>Glmnet model can be improved by Bagging. The LB score of bagged glmnet using the same features and paramters was 0.60427.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48833",
      "postDate": "06/07/2014 14:58:15",
      "content": "<p>Thanks! &nbsp;I'm not too familiar with glmnet, though - would you mind posting a bit of sample code / pointers, just for running the un-bagged glmnet and predict.glmnet? &nbsp;I think I'm using it properly, but I don't seem to be getting useful&nbsp;predictions out of it.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48837",
      "postDate": "06/07/2014 17:25:37",
      "content": "<p>Ok</p>\n<p>Here are my codes vw2csv.py and glmnet01.r.</p>\n<p>vw2csv.py converts train.vw and test.vw generated by&nbsp;Triskelion's code to csv format.</p>\n<p>glmnet01.r outputs a submission file.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48838",
      "postDate": "06/07/2014 17:38:21",
      "content": "<p>Thank you very much!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48839",
      "postDate": "06/07/2014 17:49:14",
      "content": "<p>Oops! Sorry for the duplicate files. The last 2 files are correct version.</p>\n<p>Does anyone know how to remove those attachments? I don't see any menu item for removing attachment.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "48860",
      "postDate": "06/08/2014 12:41:47",
      "content": "<p>[quote=tks;48837]</p>\n<p>Ok</p>\n<p>Here are my codes vw2csv.py and glmnet01.r.</p>\n<p>vw2csv.py converts train.vw and test.vw generated by&nbsp;Triskelion's code to csv format.</p>\n<p>glmnet01.r outputs a submission file.</p>\n<p>[/quote]</p>\n\n<p>Thanks for sharing :D&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49083",
      "postDate": "06/13/2014 03:59:56",
      "content": "<p>Hi Thomas,</p>\n\n<p>the submissions are being evaluated based on AUC/ROC.</p>\n\n<p>What this does is try every possible cutoff threshold for what constitutes True/False</p>\n\n<p>For instance if we have 4 regression score values [0.0, .25, .5, 1.0] and we have [0, 0, 1, 1] as the real scores.</p>\n\n<p>For threshold of</p>\n<p>1.0, 1 true, 3 false - 1 error</p>\n<p>.5, 2 true, 2 false - 0 error</p>\n<p>.25, 3 true, 1 false - 1 error</p>\n<p>.0 , 4 true, 0 false - 2 errors</p>\n\n<p>So the best cutoff is .5 which gives a perfect AUC score of 1.0</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49100",
      "postDate": "06/13/2014 13:58:05",
      "content": "<p>Hi tks,</p>\n\n<p>It's interesting to me that such a large value of lambda wouldn't cause the model to have high bias. Could&nbsp;your logic in setting it so high ? Is the bias less of a problem for logistic&nbsp;regression?&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49130",
      "postDate": "06/13/2014 23:09:17",
      "content": "<p>No logic. I simply tried several values&nbsp;and chose the best one.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49170",
      "postDate": "06/16/2014 00:56:06",
      "content": "<p>Hi TKS - what methods are you using to bag your results? The below code&nbsp;only showed a small improvement (0.00155) over running the&nbsp;regression alone:</p>\n\n<p>I ran the following code for 5000 iterations and averaged the predicted results on each 'fit'.&nbsp;I've included the code with the pseudo code in comments:</p>\n\n<p># Sample 1-1/e (63%) percent of dataset</p>\n<p>pos &lt;- sample(nrow(X),size=floor(nrow(X)*(1 - 1/exp(1)) ))</p>\n\n<p># resample (m - 0.63*m)&nbsp;duplicates from&nbsp;this subset and&nbsp;add to the original sample<br> pos &lt;- c(pos,sample(pos,size=nrow(X)-length(pos)))</p>\n\n<p># run a regression on this dataset<br> fit &lt;- glmnet(X[pos,], Y[pos,], family = &quot;binomial&quot;,<br> alpha = 0, lambda=2^17)</p>\n\n<p># Predict on Test set</p>\n\n<p># average the results of the 5000 predictions</p>\n\n<p>Thanks</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49173",
      "postDate": "06/16/2014 04:17:06",
      "content": "<p>Hi,</p>\n<p>Is there an R package that can&nbsp;wrap bagging around glmnet (or any other trainer)?&nbsp;</p>\n<p>Thanks,</p>\n<p>C</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49200",
      "postDate": "06/16/2014 14:10:12",
      "content": "<p>My current bagging implementation was based on this article:</p>\n\n\n<p>http://www.r-bloggers.com/improve-predictive-performance-in-r-with-bagging/</p>\n\n\n<p>I significantly improved my glmnet-based leaderboard score&nbsp;by bagging along those lines.</p>\n\n\n<p>Also, in general, if you're new to R, I've found the caret package (and accompanying book, <em>Applied Predictive Modeling</em>) to be incredibly useful.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49284",
      "postDate": "06/18/2014 21:43:22",
      "content": "<p>[quote=ddunder;49170]</p>\n<p># Sample 1-1/e (63%) percent of dataset</p>\n<p>[/quote]</p>\n<p>The sample size is a parameter to tune. I used much smaller.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49291",
      "postDate": "06/19/2014 07:43:37",
      "content": "<p>Hi,</p>\n<p>I can't get the tks's solution. I was running the code posted by tks using glmnet package, but the result is much worse. Does anybody have the same problem?</p>\n\n<p>Thanks.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49294",
      "postDate": "06/19/2014 08:17:06",
      "content": "<p>For me I get the exact&nbsp;LB score tks got for the un-bagged solution, but when I try to use bagging the way suggested by the article&nbsp;Phil Culliton suggested&nbsp;I get lower LB score (0.60186)&nbsp;compared to the&nbsp; 0.60427 tks got.</p>\n\n<p>Perroquet, maybe something in your&nbsp;feature extraction phase was different.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49303",
      "postDate": "06/19/2014 14:48:01",
      "content": "<p>[quote=culstifier;49294]<br>For me I get the exact LB score tks got for the un-bagged solution, but when I try to use bagging the way suggested by the article Phil Culliton suggested I get lower LB score (0.60186) compared to the 0.60427 tks got.<br>[/quote]</p>\n\n<p>The article I posted uses a pretty&nbsp;large sample size. &nbsp;As tks mentions, that's something that needs to be tuned for the data - a different&nbsp;sample size or sampling method may improve your score.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49329",
      "postDate": "06/20/2014 09:35:51",
      "content": "<p>Thanks Phil!</p>\n<p>It worked much better with 5% sample.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49474",
      "postDate": "06/24/2014 10:49:59",
      "content": "<p>Hi, I tried running glmnet for my model and got the exact same score for unbagged, but I'm not able to reach 0.60427. I'm using about 2000 iterations and I've varied sample size from 5% to about 30%. Is there anything apart from sample size that needs tweaking? Probably a different bagging method, I guess?</p>\n\n<p>Also, the most important question what i wanted to ask was about the output of the glmnet script. How do you interpret this repeatProbability output? Almost all of the repeat probabilities seem to be starting this way; with &quot;0.2714....&quot;. Does anyone know how to interpret this? Or how it is used for ranking the customers?</p>\n\n<p>id repeatProbability</p>\n<p>12262064 0.271465247</p>\n<p>12277270 0.271466099</p>\n<p>12332190 0.27146523</p>\n<p>12524696 0.27146534 1</p>\n<p>3074629 0.271465299</p>\n\n\n<p>Thank you and have a great day! :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49499",
      "postDate": "06/24/2014 18:47:25",
      "content": "<p>meet thakkar,</p>\n<p>Not sure what might be the issue with your bagged&nbsp;glmnet implementation. 2000&nbsp;iterations and 5% sampling should give you close to the&nbsp;0.60427 LB score.&nbsp;If you would like, provide the relevant code here for review.&nbsp;</p>\n\n<p>Regarding the&nbsp;probabilities question, in&nbsp;ROC&nbsp;curve the order of the probabilities is important the value itself isn't.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49547",
      "postDate": "06/25/2014 10:47:10",
      "content": "<p>[quote=culstifier;49499]</p>\n<p>meet thakkar,</p>\n<p>Not sure what might be the issue with your bagged&nbsp;glmnet implementation. 2000&nbsp;iterations and 5% sampling should give you close to the&nbsp;0.60427 LB score.&nbsp;If you would like, provide the relevant code here for review.&nbsp;</p>\n<p>Regarding the&nbsp;probabilities question, in&nbsp;ROC&nbsp;curve the order of the probabilities is important the value itself isn't.</p>\n<p>[/quote]</p>\n\n<p>clustifier,</p>\n<p>here's my code for bagging</p>\n\n<p>#get 5% samples from the training set</p>\n<p>training_positions &lt;- sample(nrow(training1), size=floor((nrow(training1)*0.05)))</p>\n<p>#sample original again to get n-training_positions number of samples<br> pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br> training_positions &lt;- c(training_positions,pos)</p>\n<p>xTrain&lt;-training1[training_positions,]<br> target&lt;-xTrain$repeter</p>\n<p>#remove first 3 columns(repeter, offerqty, id)<br> xTrain &lt;- as.matrix(training1[training_positions,-(1:3)])</p>\n<p>#build glmnet model<br> model &lt;- glmnet(xTrain, target, family = &quot;binomial&quot;, alpha = 0, lambda = 2^17)</p>\n<p>#predict&nbsp;<br>predict(model, xtesting, type=&quot;response&quot;)</p>\n\n<p>I run this code for about 2000 iterations to get 2000 predictions and then average it out</p>\n<p>id's not in testset but in testHistory will get 0 probability</p>\n\n\n<p>So, kindly help me out by pointing where I'm making a mistake here.</p>\n\n<p>Thanks in advance!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49548",
      "postDate": "06/25/2014 10:51:08",
      "content": "<p>how is the performance of LR</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49579",
      "postDate": "06/25/2014 16:26:35",
      "content": "<p>meet thakkar,</p>\n<p>just delete these lines:</p>\n<p><code>#sample original again to get n-training_positions number of samples<br>pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br>training_positions &lt;- c(training_positions,pos)</code></p>\n\n<p>You want to train only on 5% of the data, these three lines add back almost all the data.</p>\n\n<p>Just delete those lines and I think&nbsp;it will be good.</p>\n\n<p>(please, don't forget to click the Thank link in the bottom of the posts if you would like to thank someone :-)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49604",
      "postDate": "06/26/2014 05:53:32",
      "content": "<p>[quote=culstifier;49579]</p>\n<p>meet thakkar,</p>\n<p>just delete these lines:</p>\n<p><code>#sample original again to get n-training_positions number of samples<br>pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br>training_positions &lt;- c(training_positions,pos)</code></p>\n<p>You want to train only on 5% of the data, these three lines add back almost all the data.</p>\n<p>Just delete those lines and I think&nbsp;it will be good.</p>\n<p>(please, don't forget to click the Thank link in the bottom of the posts if you would like to thank someone :-)</p>\n<p>[/quote]</p>\n\n\n\n<p>Worked like a charm. Thanks! :)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49605",
      "postDate": "06/26/2014 06:08:10",
      "content": "<p>meet thakkar,</p>\n<p>have you used more or different features than these mentioned in:&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\" target=\"_blank\">Feature engineering and beat the benchmark (~0.59347)</a>?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49612",
      "postDate": "06/26/2014 10:31:31",
      "content": "<p>culstifier,</p>\n<p>You mentioned that in ROC curve the order of the probabilities is important rather than the value itself , Can you explain more or provide some pointers to refer about that .</p>\n\n<p>Thanks!!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49614",
      "postDate": "06/26/2014 11:01:05",
      "content": "<p>Look at the&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/details/evaluation\" target=\"_blank\">Evaluation</a>&nbsp;page and also the link to <a href=\"http://en.wikipedia.org/wiki/Receiver_operating_characteristic\">Wikipedia</a>&nbsp;there.</p>\n<p>To calculate the area under the ROC curve what actually determine the score is the order. The reason is&nbsp;that&nbsp;peeking the point to put the threshold between the positive and negative estimates (see the Wikipedia page for the full explanation about the threshold) doesn't affect by the score (the AUC, area under the curve) itself. Only the order&nbsp;affects that.</p>\n\n\n<p>Think of it as ordering your result by probability, moving the&nbsp;threshold probability from 0 to 1 and assign all those smaller than the&nbsp;threshold to one class and all the other to the other class. For each&nbsp;threshold probability count the number of false positives and the number of true positives. These numbers will be affected only by the order not by the values.</p>\n\n\n<p>Hope it helps.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49748",
      "postDate": "06/28/2014 01:18:59",
      "content": "<p>Hi All,</p>\n\n<p>&nbsp; &nbsp; I am also using the sparse logistic regression but not the R package 'glmnet'. I have several questions about&nbsp;the experimental settings in the R code.</p>\n\n<p>&nbsp; &nbsp; (1) In previous&nbsp;codes, the training data was inputted to glmnet() and the default setting for standardization is TRUE (from the manual for glmnet). Is it z-score? And&nbsp;I was wondering whether&nbsp;the function predict() standardizes the&nbsp;test data or not. Theoretically, they should be standardized separately, right? Z-score indeed does not perform well in my implementations. Any suggestions for standardization?</p>\n\n<p>&nbsp; &nbsp; (2) It seems that 2^17 is a quite large penalty. Could anyone tell me how sparse the coefficient vector is in this case? For example, how many non-zero entries when using&nbsp;2^17?</p>\n\n<p>Thanks a lot~</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49749",
      "postDate": "06/28/2014 02:09:34",
      "content": "<p>Hey hunterluffy. In glmnet:</p>\n\n<p>1) Predict will standardize the test data using the means and standard deviations of the training data.</p>\n\n<p>2) In the settings of the code posted, alpha=0 so the regularization penalty is the ridge penalty (or in other words ||B||^2 for coefficient vector B). With this squared penalty, the coefficients will be shrumk to a very small size but none will go to zero. An alpha of 1 would penalize the absolute value ||B|| of the coefficients, and a value in-between will penalize a mix of the two. (For me, alpha=0 seems to work the best for this data but maybe you can get something reasonable with another alpha)</p>\n\n<p>Hope this helps!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49750",
      "postDate": "06/28/2014 02:12:48",
      "content": "<p>Got it~ Thanks a lot,&nbsp;Thomas !</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49819",
      "postDate": "06/30/2014 05:53:28",
      "content": "<p>[quote=clustifier;49605]</p>\n<p>meet thakkar,</p>\n<p>have you used more or different features than these mentioned in:&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\" target=\"_blank\">Feature engineering and beat the benchmark (~0.59347)</a>?</p>\n<p>[/quote]</p>\n<p>clustifier,</p>\n<p>I am using few features from the link as well as few features of my own. How about you?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49820",
      "postDate": "06/30/2014 06:04:17",
      "content": "<p>No feature that I've tried to add significantly changed my LB score.</p>\n<p>Playing little with the bins of days features somewhat helped.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49822",
      "postDate": "06/30/2014 06:13:19",
      "content": "<p>Oh, a few new features helped my LB score a little(I tried many. But only a few helped!). I haven't tried binning though. You're using the same glmnet bagging for your model, right?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49878",
      "postDate": "06/30/2014 18:59:39",
      "content": "<p>Yes. Same&nbsp;glmnet &amp;&nbsp;bagging.</p>\n\n<p>I'm not sure what to try next.</p>\n<p>Adding more new features or trying new algorithm.</p>\n\n<p>I it been mentioned that using features from the full data help significantly but I couldn't think of good feature from the full&nbsp;transactions file that are not already in the reduced data.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49889",
      "postDate": "07/01/2014 05:47:26",
      "content": "<p>[quote=clustifier;49878]</p>\n<p>Yes. Same&nbsp;glmnet &amp;&nbsp;bagging.</p>\n<p>I'm not sure what to try next.</p>\n<p>Adding more new features or trying new algorithm.</p>\n<p>I it been mentioned that using features from the full data help significantly but I couldn't think of good feature from the full&nbsp;transactions file that are not already in the reduced data.</p>\n<p>[/quote]</p>\n\n<p>I think adding new features might be a better option than trying new algorithms.</p>\n<p>For me, I have a few features, but i need to focus on better preprocessing techniques like binning as you suggested, I reckon.</p>\n\n<p>And trying the entire 22GB data will be my last option I guess.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49915",
      "postDate": "07/01/2014 17:10:58",
      "content": "<p>Interesting - I've taken a different path to my current score. &nbsp;All of my advances have come via Vowpal Wabbit and adding new features. &nbsp;I've come up with&nbsp;a fair number of new&nbsp;classes of features that have improved&nbsp;my VW performance significantly. &nbsp;I also switched to the full data set weeks ago. &nbsp;Apparently, given our respective positions on the leaderboard (I'm a few dozen places behind both of you at the moment) all that may not have been the optimal approach. &nbsp;It was fun, though! &nbsp;:-)</p>\n<p>When I switch to glmnet and bagging, however, it doesn't perform as well. &nbsp;So I may have a bug somewhere in my glmnet code... or, also&nbsp;likely, my VW features need to be tuned for the glmnet context. &nbsp;Hmm. &nbsp;I've tried cutting out features that seemed like they'd be less useful there, but so far&nbsp;no luck.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49935",
      "postDate": "07/02/2014 05:44:43",
      "content": "<p>[quote=Phil Culliton;49915]</p>\n<p>Interesting - I've taken a different path to my current score. &nbsp;All of my advances have come via Vowpal Wabbit and adding new features. &nbsp;I've come up with&nbsp;a fair number of new&nbsp;classes of features that have improved&nbsp;my VW performance significantly. &nbsp;I also switched to the full data set weeks ago. &nbsp;Apparently, given our respective positions on the leaderboard (I'm a few dozen places behind both of you at the moment) all that may not have been the optimal approach. &nbsp;It was fun, though! &nbsp;:-)</p>\n<p>When I switch to glmnet and bagging, however, it doesn't perform as well. &nbsp;So I may have a bug somewhere in my glmnet code... or, also&nbsp;likely, my VW features need to be tuned for the glmnet context. &nbsp;Hmm. &nbsp;I've tried cutting out features that seemed like they'd be less useful there, but so far&nbsp;no luck.</p>\n<p>[/quote]</p>\n\n<p>Phil,</p>\n<p>I tried VW in the beginning, but glmnet(without bagging) improved my score. Then I tried it with bagging and it improved my score a little more. I only added a very few new features(Had created a lot. But only a very few helped!). I think I should think of some new and better features to add.</p>\n\n<p>Did the full dataset help in improving the score? I'm thinking of using it, but I'm not sure how much of a help it will be?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49956",
      "postDate": "07/02/2014 12:40:10",
      "content": "<p>Thanks! &nbsp;I went back to the original data set, with just a few features added which had performed well across methods, and glmnet still underperforms significantly for me, so I'm pretty sure I've got some bugs in my glmnet code. &nbsp;Debugging time! &nbsp;:-)</p>\n\n<p>For glmnet, I'm not sure how much value is added by the full set - I've noted similar CV / LB scores for both. &nbsp;It seems to help VW pretty significantly - my LB scores jumped up when I started using it. &nbsp;I think it helps to fill out the weight vectors and make them cover more corner cases.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49965",
      "postDate": "07/02/2014 18:41:02",
      "content": "<p>[quote=Phil Culliton;49956]</p>\n<p>I think it helps to fill out the weight vectors and make them cover more corner cases.</p>\n<p>[/quote]</p>\n\n<p>Can you please explain that more?</p>\n\n<p>I can't think why the data not in the reduced will help. It looks to me like completely irrelevant data.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49967",
      "postDate": "07/02/2014 19:04:01",
      "content": "<p>Sure! &nbsp;You're basically capturing potential indirect relationships. &nbsp;For instance, if you're tracking specific brands bought, purchasing related brands Y-Z multiple times - even if they didn't have a coupon - may indicate a propensity to purchase brand X more than once, or vice versa.</p>\n\n<p>In VW terms, this translates to providing more members of the weight vector which help distinguish similarity, which is probably why it performs so well there. &nbsp;I definitely had a large jump when I switched to using the full transaction set with VW.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "58714",
      "postDate": "11/23/2014 06:03:45",
      "content": "<p>Hi Everyone,</p>\n<p>I am new to data analysis and working on this project for knowledge and learning. I have applied the glmnet model on features created, which are quite similar to one mentioned by Treskelion. But when I am trying to plot it I cannot see anything.</p>\n<p>For learning purpose I am working just on train dataset and have not included test one.</p>\n<p>I have created the model using command in R:</p>\n<p>model = glmnet(xmerge,target,family=&quot;binomial&quot;, alpha = 0, lambda=2^17)</p>\n<p>where xmerge contains all my numeric measures. I want to see in all the features which one has highest impact. How can I see that with the help of plots/graphs?</p>\n<p>Any help will be appreciated.</p>\n<p>Thanks!!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "69960",
      "postDate": "04/08/2015 00:30:11",
      "content": "<p>[quote=tks;48824]</p>\n<p>[quote=Upul Bandara;43265]</p>\n<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>\n<p>[/quote]</p>\n<p>I tried R package glmnet(alpha = 0, lambda = 2^17, family = &quot;binomial&quot;) on the&nbsp;Triskelion's features except&nbsp;offer_quantity and got&nbsp;0.59565. The reason for the difference between Upul's score and mine may be the parameter estimation method employed by glmnet. See&nbsp;<a href=\"http://www.stanford.edu/~hastie/Papers/glmnet.pdf\">Regularization Paths for Generalized Linear Models via Coordinate Descent</a>&nbsp;in detail.<br>Glmnet model can be improved by Bagging. The LB score of bagged glmnet using the same features and paramters was 0.60427.&nbsp;</p>\n<p>[/quote]</p>\n\n<p>TKS - you were kind enough to post your glmnet R code, so I thought I'd ask if you might be willing to&nbsp;share how you&nbsp;approached translating Triskelion's features from VW/Python into R. I'm working on an academic team that is going through this old competition to practice our R skills. Thanks for considering this request!</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 43307,
      "author_name": "zachmayer",
      "author_url": "",
      "post_date": "04/29/2014 15:45:55",
      "content": "<p>Yes, VW does some magic. &nbsp;It uses <a href=\"http://en.wikipedia.org/wiki/Stochastic_gradient_descent\">stochastic gradient descent</a>, which is a little less sensitive to outliers. &nbsp;The code you linked to also uses <a href=\"http://en.wikipedia.org/wiki/Quantile_regression\">quantile regression</a>, rather than logistic regression, which seems to give better results on this dataset. &nbsp;I haven't figured out why they use a quantile_tau of 0.60 rather than the median, but that magic number also seems to give better results on this dataset.</p>\n<p>Finally, it's possible that the featureset you built yourself is different from the one built in the linked post. &nbsp;Check your subsets and aggregations carefully!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 44415,
      "author_name": "breuker",
      "author_url": "",
      "post_date": "05/12/2014 16:43:49",
      "content": "<p>If you want to use another tool, bear in mind that vw has a couple of features on by default&nbsp;that may or may not be implemented (e.g., adaptive, normalized, invariant update rules / using holdout data to determine how many passes you need&nbsp;/ ...)</p>\n<p>Here is a very brief description of what it does: https://github.com/JohnLangford/vowpal_wabbit/wiki/Command-line-arguments</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 47261,
      "author_name": "mike64",
      "author_url": "",
      "post_date": "05/29/2014 14:35:21",
      "content": "<p>What percentage of repeaters classifies the model right?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48814,
      "author_name": "omalleyt",
      "author_url": "",
      "post_date": "06/07/2014 00:07:57",
      "content": "<p>How can quantile regression be used on a binomial problem?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48824,
      "author_name": "tks0123456789",
      "author_url": "",
      "post_date": "06/07/2014 09:30:16",
      "content": "<p>[quote=Upul Bandara;43265]</p>\n<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>\n<p>[/quote]</p>\n<p>I tried R package glmnet(alpha = 0, lambda = 2^17, family = &quot;binomial&quot;) on the&nbsp;Triskelion's features except&nbsp;offer_quantity and got&nbsp;0.59565. The reason for the difference between Upul's score and mine may be the parameter estimation method employed by glmnet. See&nbsp;<a href=\"http://www.stanford.edu/~hastie/Papers/glmnet.pdf\">Regularization Paths for Generalized Linear Models via Coordinate Descent</a>&nbsp;in detail.<br>Glmnet model can be improved by Bagging. The LB score of bagged glmnet using the same features and paramters was 0.60427.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48833,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "06/07/2014 14:58:15",
      "content": "<p>Thanks! &nbsp;I'm not too familiar with glmnet, though - would you mind posting a bit of sample code / pointers, just for running the un-bagged glmnet and predict.glmnet? &nbsp;I think I'm using it properly, but I don't seem to be getting useful&nbsp;predictions out of it.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48837,
      "author_name": "tks0123456789",
      "author_url": "",
      "post_date": "06/07/2014 17:25:37",
      "content": "<p>Ok</p>\n<p>Here are my codes vw2csv.py and glmnet01.r.</p>\n<p>vw2csv.py converts train.vw and test.vw generated by&nbsp;Triskelion's code to csv format.</p>\n<p>glmnet01.r outputs a submission file.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48838,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "06/07/2014 17:38:21",
      "content": "<p>Thank you very much!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48839,
      "author_name": "tks0123456789",
      "author_url": "",
      "post_date": "06/07/2014 17:49:14",
      "content": "<p>Oops! Sorry for the duplicate files. The last 2 files are correct version.</p>\n<p>Does anyone know how to remove those attachments? I don't see any menu item for removing attachment.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 48860,
      "author_name": "tayshin",
      "author_url": "",
      "post_date": "06/08/2014 12:41:47",
      "content": "<p>[quote=tks;48837]</p>\n<p>Ok</p>\n<p>Here are my codes vw2csv.py and glmnet01.r.</p>\n<p>vw2csv.py converts train.vw and test.vw generated by&nbsp;Triskelion's code to csv format.</p>\n<p>glmnet01.r outputs a submission file.</p>\n<p>[/quote]</p>\n\n<p>Thanks for sharing :D&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49083,
      "author_name": "letterrip",
      "author_url": "",
      "post_date": "06/13/2014 03:59:56",
      "content": "<p>Hi Thomas,</p>\n\n<p>the submissions are being evaluated based on AUC/ROC.</p>\n\n<p>What this does is try every possible cutoff threshold for what constitutes True/False</p>\n\n<p>For instance if we have 4 regression score values [0.0, .25, .5, 1.0] and we have [0, 0, 1, 1] as the real scores.</p>\n\n<p>For threshold of</p>\n<p>1.0, 1 true, 3 false - 1 error</p>\n<p>.5, 2 true, 2 false - 0 error</p>\n<p>.25, 3 true, 1 false - 1 error</p>\n<p>.0 , 4 true, 0 false - 2 errors</p>\n\n<p>So the best cutoff is .5 which gives a perfect AUC score of 1.0</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49100,
      "author_name": "dansterba",
      "author_url": "",
      "post_date": "06/13/2014 13:58:05",
      "content": "<p>Hi tks,</p>\n\n<p>It's interesting to me that such a large value of lambda wouldn't cause the model to have high bias. Could&nbsp;your logic in setting it so high ? Is the bias less of a problem for logistic&nbsp;regression?&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49130,
      "author_name": "tks0123456789",
      "author_url": "",
      "post_date": "06/13/2014 23:09:17",
      "content": "<p>No logic. I simply tried several values&nbsp;and chose the best one.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49170,
      "author_name": "dansterba",
      "author_url": "",
      "post_date": "06/16/2014 00:56:06",
      "content": "<p>Hi TKS - what methods are you using to bag your results? The below code&nbsp;only showed a small improvement (0.00155) over running the&nbsp;regression alone:</p>\n\n<p>I ran the following code for 5000 iterations and averaged the predicted results on each 'fit'.&nbsp;I've included the code with the pseudo code in comments:</p>\n\n<p># Sample 1-1/e (63%) percent of dataset</p>\n<p>pos &lt;- sample(nrow(X),size=floor(nrow(X)*(1 - 1/exp(1)) ))</p>\n\n<p># resample (m - 0.63*m)&nbsp;duplicates from&nbsp;this subset and&nbsp;add to the original sample<br> pos &lt;- c(pos,sample(pos,size=nrow(X)-length(pos)))</p>\n\n<p># run a regression on this dataset<br> fit &lt;- glmnet(X[pos,], Y[pos,], family = &quot;binomial&quot;,<br> alpha = 0, lambda=2^17)</p>\n\n<p># Predict on Test set</p>\n\n<p># average the results of the 5000 predictions</p>\n\n<p>Thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49173,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/16/2014 04:17:06",
      "content": "<p>Hi,</p>\n<p>Is there an R package that can&nbsp;wrap bagging around glmnet (or any other trainer)?&nbsp;</p>\n<p>Thanks,</p>\n<p>C</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49200,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "06/16/2014 14:10:12",
      "content": "<p>My current bagging implementation was based on this article:</p>\n\n\n<p>http://www.r-bloggers.com/improve-predictive-performance-in-r-with-bagging/</p>\n\n\n<p>I significantly improved my glmnet-based leaderboard score&nbsp;by bagging along those lines.</p>\n\n\n<p>Also, in general, if you're new to R, I've found the caret package (and accompanying book, <em>Applied Predictive Modeling</em>) to be incredibly useful.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49284,
      "author_name": "tks0123456789",
      "author_url": "",
      "post_date": "06/18/2014 21:43:22",
      "content": "<p>[quote=ddunder;49170]</p>\n<p># Sample 1-1/e (63%) percent of dataset</p>\n<p>[/quote]</p>\n<p>The sample size is a parameter to tune. I used much smaller.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49291,
      "author_name": "quickjanca",
      "author_url": "",
      "post_date": "06/19/2014 07:43:37",
      "content": "<p>Hi,</p>\n<p>I can't get the tks's solution. I was running the code posted by tks using glmnet package, but the result is much worse. Does anybody have the same problem?</p>\n\n<p>Thanks.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49294,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/19/2014 08:17:06",
      "content": "<p>For me I get the exact&nbsp;LB score tks got for the un-bagged solution, but when I try to use bagging the way suggested by the article&nbsp;Phil Culliton suggested&nbsp;I get lower LB score (0.60186)&nbsp;compared to the&nbsp; 0.60427 tks got.</p>\n\n<p>Perroquet, maybe something in your&nbsp;feature extraction phase was different.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49303,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "06/19/2014 14:48:01",
      "content": "<p>[quote=culstifier;49294]<br>For me I get the exact LB score tks got for the un-bagged solution, but when I try to use bagging the way suggested by the article Phil Culliton suggested I get lower LB score (0.60186) compared to the 0.60427 tks got.<br>[/quote]</p>\n\n<p>The article I posted uses a pretty&nbsp;large sample size. &nbsp;As tks mentions, that's something that needs to be tuned for the data - a different&nbsp;sample size or sampling method may improve your score.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49329,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/20/2014 09:35:51",
      "content": "<p>Thanks Phil!</p>\n<p>It worked much better with 5% sample.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49474,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "06/24/2014 10:49:59",
      "content": "<p>Hi, I tried running glmnet for my model and got the exact same score for unbagged, but I'm not able to reach 0.60427. I'm using about 2000 iterations and I've varied sample size from 5% to about 30%. Is there anything apart from sample size that needs tweaking? Probably a different bagging method, I guess?</p>\n\n<p>Also, the most important question what i wanted to ask was about the output of the glmnet script. How do you interpret this repeatProbability output? Almost all of the repeat probabilities seem to be starting this way; with &quot;0.2714....&quot;. Does anyone know how to interpret this? Or how it is used for ranking the customers?</p>\n\n<p>id repeatProbability</p>\n<p>12262064 0.271465247</p>\n<p>12277270 0.271466099</p>\n<p>12332190 0.27146523</p>\n<p>12524696 0.27146534 1</p>\n<p>3074629 0.271465299</p>\n\n\n<p>Thank you and have a great day! :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49499,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/24/2014 18:47:25",
      "content": "<p>meet thakkar,</p>\n<p>Not sure what might be the issue with your bagged&nbsp;glmnet implementation. 2000&nbsp;iterations and 5% sampling should give you close to the&nbsp;0.60427 LB score.&nbsp;If you would like, provide the relevant code here for review.&nbsp;</p>\n\n<p>Regarding the&nbsp;probabilities question, in&nbsp;ROC&nbsp;curve the order of the probabilities is important the value itself isn't.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49547,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "06/25/2014 10:47:10",
      "content": "<p>[quote=culstifier;49499]</p>\n<p>meet thakkar,</p>\n<p>Not sure what might be the issue with your bagged&nbsp;glmnet implementation. 2000&nbsp;iterations and 5% sampling should give you close to the&nbsp;0.60427 LB score.&nbsp;If you would like, provide the relevant code here for review.&nbsp;</p>\n<p>Regarding the&nbsp;probabilities question, in&nbsp;ROC&nbsp;curve the order of the probabilities is important the value itself isn't.</p>\n<p>[/quote]</p>\n\n<p>clustifier,</p>\n<p>here's my code for bagging</p>\n\n<p>#get 5% samples from the training set</p>\n<p>training_positions &lt;- sample(nrow(training1), size=floor((nrow(training1)*0.05)))</p>\n<p>#sample original again to get n-training_positions number of samples<br> pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br> training_positions &lt;- c(training_positions,pos)</p>\n<p>xTrain&lt;-training1[training_positions,]<br> target&lt;-xTrain$repeter</p>\n<p>#remove first 3 columns(repeter, offerqty, id)<br> xTrain &lt;- as.matrix(training1[training_positions,-(1:3)])</p>\n<p>#build glmnet model<br> model &lt;- glmnet(xTrain, target, family = &quot;binomial&quot;, alpha = 0, lambda = 2^17)</p>\n<p>#predict&nbsp;<br>predict(model, xtesting, type=&quot;response&quot;)</p>\n\n<p>I run this code for about 2000 iterations to get 2000 predictions and then average it out</p>\n<p>id's not in testset but in testHistory will get 0 probability</p>\n\n\n<p>So, kindly help me out by pointing where I'm making a mistake here.</p>\n\n<p>Thanks in advance!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49548,
      "author_name": "sistzyhndcw",
      "author_url": "",
      "post_date": "06/25/2014 10:51:08",
      "content": "<p>how is the performance of LR</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49579,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/25/2014 16:26:35",
      "content": "<p>meet thakkar,</p>\n<p>just delete these lines:</p>\n<p><code>#sample original again to get n-training_positions number of samples<br>pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br>training_positions &lt;- c(training_positions,pos)</code></p>\n\n<p>You want to train only on 5% of the data, these three lines add back almost all the data.</p>\n\n<p>Just delete those lines and I think&nbsp;it will be good.</p>\n\n<p>(please, don't forget to click the Thank link in the bottom of the posts if you would like to thank someone :-)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49604,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "06/26/2014 05:53:32",
      "content": "<p>[quote=culstifier;49579]</p>\n<p>meet thakkar,</p>\n<p>just delete these lines:</p>\n<p><code>#sample original again to get n-training_positions number of samples<br>pos&lt;-sample(nrow(training1),size=nrow(training1)-length(training_positions))<br>training_positions &lt;- c(training_positions,pos)</code></p>\n<p>You want to train only on 5% of the data, these three lines add back almost all the data.</p>\n<p>Just delete those lines and I think&nbsp;it will be good.</p>\n<p>(please, don't forget to click the Thank link in the bottom of the posts if you would like to thank someone :-)</p>\n<p>[/quote]</p>\n\n\n\n<p>Worked like a charm. Thanks! :)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49605,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/26/2014 06:08:10",
      "content": "<p>meet thakkar,</p>\n<p>have you used more or different features than these mentioned in:&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\" target=\"_blank\">Feature engineering and beat the benchmark (~0.59347)</a>?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49612,
      "author_name": "vivekaditya",
      "author_url": "",
      "post_date": "06/26/2014 10:31:31",
      "content": "<p>culstifier,</p>\n<p>You mentioned that in ROC curve the order of the probabilities is important rather than the value itself , Can you explain more or provide some pointers to refer about that .</p>\n\n<p>Thanks!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49614,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/26/2014 11:01:05",
      "content": "<p>Look at the&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/details/evaluation\" target=\"_blank\">Evaluation</a>&nbsp;page and also the link to <a href=\"http://en.wikipedia.org/wiki/Receiver_operating_characteristic\">Wikipedia</a>&nbsp;there.</p>\n<p>To calculate the area under the ROC curve what actually determine the score is the order. The reason is&nbsp;that&nbsp;peeking the point to put the threshold between the positive and negative estimates (see the Wikipedia page for the full explanation about the threshold) doesn't affect by the score (the AUC, area under the curve) itself. Only the order&nbsp;affects that.</p>\n\n\n<p>Think of it as ordering your result by probability, moving the&nbsp;threshold probability from 0 to 1 and assign all those smaller than the&nbsp;threshold to one class and all the other to the other class. For each&nbsp;threshold probability count the number of false positives and the number of true positives. These numbers will be affected only by the order not by the values.</p>\n\n\n<p>Hope it helps.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49748,
      "author_name": "sundevil",
      "author_url": "",
      "post_date": "06/28/2014 01:18:59",
      "content": "<p>Hi All,</p>\n\n<p>&nbsp; &nbsp; I am also using the sparse logistic regression but not the R package 'glmnet'. I have several questions about&nbsp;the experimental settings in the R code.</p>\n\n<p>&nbsp; &nbsp; (1) In previous&nbsp;codes, the training data was inputted to glmnet() and the default setting for standardization is TRUE (from the manual for glmnet). Is it z-score? And&nbsp;I was wondering whether&nbsp;the function predict() standardizes the&nbsp;test data or not. Theoretically, they should be standardized separately, right? Z-score indeed does not perform well in my implementations. Any suggestions for standardization?</p>\n\n<p>&nbsp; &nbsp; (2) It seems that 2^17 is a quite large penalty. Could anyone tell me how sparse the coefficient vector is in this case? For example, how many non-zero entries when using&nbsp;2^17?</p>\n\n<p>Thanks a lot~</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49749,
      "author_name": "omalleyt",
      "author_url": "",
      "post_date": "06/28/2014 02:09:34",
      "content": "<p>Hey hunterluffy. In glmnet:</p>\n\n<p>1) Predict will standardize the test data using the means and standard deviations of the training data.</p>\n\n<p>2) In the settings of the code posted, alpha=0 so the regularization penalty is the ridge penalty (or in other words ||B||^2 for coefficient vector B). With this squared penalty, the coefficients will be shrumk to a very small size but none will go to zero. An alpha of 1 would penalize the absolute value ||B|| of the coefficients, and a value in-between will penalize a mix of the two. (For me, alpha=0 seems to work the best for this data but maybe you can get something reasonable with another alpha)</p>\n\n<p>Hope this helps!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49750,
      "author_name": "sundevil",
      "author_url": "",
      "post_date": "06/28/2014 02:12:48",
      "content": "<p>Got it~ Thanks a lot,&nbsp;Thomas !</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49819,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "06/30/2014 05:53:28",
      "content": "<p>[quote=clustifier;49605]</p>\n<p>meet thakkar,</p>\n<p>have you used more or different features than these mentioned in:&nbsp;<a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\" target=\"_blank\">Feature engineering and beat the benchmark (~0.59347)</a>?</p>\n<p>[/quote]</p>\n<p>clustifier,</p>\n<p>I am using few features from the link as well as few features of my own. How about you?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49820,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/30/2014 06:04:17",
      "content": "<p>No feature that I've tried to add significantly changed my LB score.</p>\n<p>Playing little with the bins of days features somewhat helped.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49822,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "06/30/2014 06:13:19",
      "content": "<p>Oh, a few new features helped my LB score a little(I tried many. But only a few helped!). I haven't tried binning though. You're using the same glmnet bagging for your model, right?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49878,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "06/30/2014 18:59:39",
      "content": "<p>Yes. Same&nbsp;glmnet &amp;&nbsp;bagging.</p>\n\n<p>I'm not sure what to try next.</p>\n<p>Adding more new features or trying new algorithm.</p>\n\n<p>I it been mentioned that using features from the full data help significantly but I couldn't think of good feature from the full&nbsp;transactions file that are not already in the reduced data.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49889,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "07/01/2014 05:47:26",
      "content": "<p>[quote=clustifier;49878]</p>\n<p>Yes. Same&nbsp;glmnet &amp;&nbsp;bagging.</p>\n<p>I'm not sure what to try next.</p>\n<p>Adding more new features or trying new algorithm.</p>\n<p>I it been mentioned that using features from the full data help significantly but I couldn't think of good feature from the full&nbsp;transactions file that are not already in the reduced data.</p>\n<p>[/quote]</p>\n\n<p>I think adding new features might be a better option than trying new algorithms.</p>\n<p>For me, I have a few features, but i need to focus on better preprocessing techniques like binning as you suggested, I reckon.</p>\n\n<p>And trying the entire 22GB data will be my last option I guess.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49915,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "07/01/2014 17:10:58",
      "content": "<p>Interesting - I've taken a different path to my current score. &nbsp;All of my advances have come via Vowpal Wabbit and adding new features. &nbsp;I've come up with&nbsp;a fair number of new&nbsp;classes of features that have improved&nbsp;my VW performance significantly. &nbsp;I also switched to the full data set weeks ago. &nbsp;Apparently, given our respective positions on the leaderboard (I'm a few dozen places behind both of you at the moment) all that may not have been the optimal approach. &nbsp;It was fun, though! &nbsp;:-)</p>\n<p>When I switch to glmnet and bagging, however, it doesn't perform as well. &nbsp;So I may have a bug somewhere in my glmnet code... or, also&nbsp;likely, my VW features need to be tuned for the glmnet context. &nbsp;Hmm. &nbsp;I've tried cutting out features that seemed like they'd be less useful there, but so far&nbsp;no luck.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49935,
      "author_name": "meetthakkar1",
      "author_url": "",
      "post_date": "07/02/2014 05:44:43",
      "content": "<p>[quote=Phil Culliton;49915]</p>\n<p>Interesting - I've taken a different path to my current score. &nbsp;All of my advances have come via Vowpal Wabbit and adding new features. &nbsp;I've come up with&nbsp;a fair number of new&nbsp;classes of features that have improved&nbsp;my VW performance significantly. &nbsp;I also switched to the full data set weeks ago. &nbsp;Apparently, given our respective positions on the leaderboard (I'm a few dozen places behind both of you at the moment) all that may not have been the optimal approach. &nbsp;It was fun, though! &nbsp;:-)</p>\n<p>When I switch to glmnet and bagging, however, it doesn't perform as well. &nbsp;So I may have a bug somewhere in my glmnet code... or, also&nbsp;likely, my VW features need to be tuned for the glmnet context. &nbsp;Hmm. &nbsp;I've tried cutting out features that seemed like they'd be less useful there, but so far&nbsp;no luck.</p>\n<p>[/quote]</p>\n\n<p>Phil,</p>\n<p>I tried VW in the beginning, but glmnet(without bagging) improved my score. Then I tried it with bagging and it improved my score a little more. I only added a very few new features(Had created a lot. But only a very few helped!). I think I should think of some new and better features to add.</p>\n\n<p>Did the full dataset help in improving the score? I'm thinking of using it, but I'm not sure how much of a help it will be?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49956,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "07/02/2014 12:40:10",
      "content": "<p>Thanks! &nbsp;I went back to the original data set, with just a few features added which had performed well across methods, and glmnet still underperforms significantly for me, so I'm pretty sure I've got some bugs in my glmnet code. &nbsp;Debugging time! &nbsp;:-)</p>\n\n<p>For glmnet, I'm not sure how much value is added by the full set - I've noted similar CV / LB scores for both. &nbsp;It seems to help VW pretty significantly - my LB scores jumped up when I started using it. &nbsp;I think it helps to fill out the weight vectors and make them cover more corner cases.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49965,
      "author_name": "clustifier",
      "author_url": "",
      "post_date": "07/02/2014 18:41:02",
      "content": "<p>[quote=Phil Culliton;49956]</p>\n<p>I think it helps to fill out the weight vectors and make them cover more corner cases.</p>\n<p>[/quote]</p>\n\n<p>Can you please explain that more?</p>\n\n<p>I can't think why the data not in the reduced will help. It looks to me like completely irrelevant data.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49967,
      "author_name": "philculliton",
      "author_url": "",
      "post_date": "07/02/2014 19:04:01",
      "content": "<p>Sure! &nbsp;You're basically capturing potential indirect relationships. &nbsp;For instance, if you're tracking specific brands bought, purchasing related brands Y-Z multiple times - even if they didn't have a coupon - may indicate a propensity to purchase brand X more than once, or vice versa.</p>\n\n<p>In VW terms, this translates to providing more members of the weight vector which help distinguish similarity, which is probably why it performs so well there. &nbsp;I definitely had a large jump when I switched to using the full transaction set with VW.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 58714,
      "author_name": "shainanhemrajani",
      "author_url": "",
      "post_date": "11/23/2014 06:03:45",
      "content": "<p>Hi Everyone,</p>\n<p>I am new to data analysis and working on this project for knowledge and learning. I have applied the glmnet model on features created, which are quite similar to one mentioned by Treskelion. But when I am trying to plot it I cannot see anything.</p>\n<p>For learning purpose I am working just on train dataset and have not included test one.</p>\n<p>I have created the model using command in R:</p>\n<p>model = glmnet(xmerge,target,family=&quot;binomial&quot;, alpha = 0, lambda=2^17)</p>\n<p>where xmerge contains all my numeric measures. I want to see in all the features which one has highest impact. How can I see that with the help of plots/graphs?</p>\n<p>Any help will be appreciated.</p>\n<p>Thanks!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 69960,
      "author_name": "dluzansky",
      "author_url": "",
      "post_date": "04/08/2015 00:30:11",
      "content": "<p>[quote=tks;48824]</p>\n<p>[quote=Upul Bandara;43265]</p>\n<p>Hi All,</p>\n<p>I trained a Logistic Regression model, using the features described in following thread.</p>\n<p><a href=\"https://www.kaggle.com/c/acquire-valued-shoppers-challenge/forums/t/7688/feature-engineering-and-beat-the-benchmark-0-59347\">Feature engineering and beat the benchmark (~0.59347)</a></p>\n<p>Unfortunately, its performance is much less than the performance of Vowpal Wabbit model. So I just want to know, whether a similar behavior is observed by others.</p>\n<p>Regards,<br>Upul</p>\n<p>[/quote]</p>\n<p>I tried R package glmnet(alpha = 0, lambda = 2^17, family = &quot;binomial&quot;) on the&nbsp;Triskelion's features except&nbsp;offer_quantity and got&nbsp;0.59565. The reason for the difference between Upul's score and mine may be the parameter estimation method employed by glmnet. See&nbsp;<a href=\"http://www.stanford.edu/~hastie/Papers/glmnet.pdf\">Regularization Paths for Generalized Linear Models via Coordinate Descent</a>&nbsp;in detail.<br>Glmnet model can be improved by Bagging. The LB score of bagged glmnet using the same features and paramters was 0.60427.&nbsp;</p>\n<p>[/quote]</p>\n\n<p>TKS - you were kind enough to post your glmnet R code, so I thought I'd ask if you might be willing to&nbsp;share how you&nbsp;approached translating Triskelion's features from VW/Python into R. I'm working on an academic team that is going through this old competition to practice our R skills. Thanks for considering this request!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "43265": "",
    "43307": "",
    "44415": "",
    "47261": "",
    "48814": "",
    "48824": "",
    "48833": "",
    "48837": "",
    "48838": "",
    "48839": "",
    "48860": "",
    "49083": "",
    "49100": "",
    "49130": "",
    "49170": "",
    "49173": "",
    "49200": "",
    "49284": "",
    "49291": "",
    "49294": "",
    "49303": "",
    "49329": "",
    "49474": "",
    "49499": "",
    "49547": "",
    "49548": "",
    "49579": "",
    "49604": "",
    "49605": "",
    "49612": "",
    "49614": "",
    "49748": "",
    "49749": "",
    "49750": "",
    "49819": "",
    "49820": "",
    "49822": "",
    "49878": "",
    "49889": "",
    "49915": "",
    "49935": "",
    "49956": "",
    "49965": "",
    "49967": "",
    "58714": "",
    "69960": ""
  },
  "source": "meta"
}