{
  "id": 917,
  "title": "SVM training time",
  "url": "/competitions/SemiSupervisedFeatureLearning/discussion/917",
  "author_name": "",
  "post_date": "2011-10-04T03:25:18.737Z",
  "votes": null,
  "comment_count": 5,
  "views": 9669,
  "content": "<p>Hi! I wonder what's the typical SVM training time on your side for the 50000 samples? I ran on a very good machine. 20 minutes passed and it seems it will still go on for ever... (Should I add the &quot;-h 0&quot; suggested by libsvm to speed up?)</p>\r\n<p>Thanks!</p>",
  "messages": [
    {
      "id": "5881",
      "postDate": "10/04/2011 03:25:18",
      "content": "<p>Hi! I wonder what's the typical SVM training time on your side for the 50000 samples? I ran on a very good machine. 20 minutes passed and it seems it will still go on for ever... (Should I add the &quot;-h 0&quot; suggested by libsvm to speed up?)</p>\r\n<p>Thanks!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "5885",
      "postDate": "10/04/2011 07:47:12",
      "content": "<p>I have the same issue with libsvm; Furthermore, using probabilities make the runtime even worse. I now use liblinear for my submissions, instead of probabilities I submit the confidence scores - this is really fast (less than a minute) and gives comparable\r\n results (though libsvm and liblinear optimize slightly different objective functions)</p>\r\n<p>best, <br>\r\nPeter</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "6004",
      "postDate": "10/10/2011 20:38:01",
      "content": "<p>I just got started on this a few days ago, so I'm a bit behind the curve...</p>\r\n<p>Did anybody &quot;solve&quot; the svm-train run-time problem, or at least determine whether or not this is normal behavior?</p>\r\n<p>I ask because, like the original poster, I have a decent quad-core processor and adequate memory, but svm-train seems to be taking forever; nearing an hour at the moment, which seems extreme for 50,000 samples.&nbsp; I don't usually use libsvm - I wrote my own\r\n kernel machine library/utilities years ago - but I'm trying not to stray too far off the path due to the severe time constraint.&nbsp; And learning how to use a new tool is rarely a bad thing.</p>\r\n<p>If it matters, the exact command (executed from the host's perl script) is:</p>\r\n<p><span style=\"font-family:courier new,courier\">svm-train -s 0 -t 0 -c 1.0 -b 1 tmp.train.txt tmp.model.txt</span></p>\r\n<p>Any advice or assistance is appreciated.&nbsp; Otherwise I guess I'll just let it run until it either completes or dies.</p>\r\n<p>------------------</p>\r\n<p>Update: 3 hours and counting?&nbsp; What the heck?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "6009",
      "postDate": "10/11/2011 01:39:28",
      "content": "<p>I'm at 48 hours of runtime for libsvm &amp; counting, just trying to recreate the K-means results described on the &quot;<em>Benchmark minibatch k-means, step by step&quot;</em> thread. This is pretty ridiculous. (I also wonder, how did libsvm get picked for this contest\r\n if the runtime is this bad?) Anyway, I'm going to try liblinear tonight on a different core (specifically, the LiblineaR package in R).</p>\r\n<p>UPDATE: I tried LiblineaR &amp; it's much much faster, just like Peter reported above (1 to 2 minutes on the 50k rows).&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "6010",
      "postDate": "10/11/2011 02:02:38",
      "content": "<p>Wow, that's terrible. Libsvm ran in about 10 minutes on my laptop, so we thought it would be okay for general use.\r\n</p>\r\n<p>I'll do some comparison tests with liblinear tomorrow to make sure the results are consistent with libsvm, and assuming they are it should be fine to use either package.\r\n</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "6016",
      "postDate": "10/11/2011 05:09:42",
      "content": "<p>Another update: I don't have Chris' patience, so I killed svm-train after 5 hours.</p>\r\n<p>Rather than skip right to liblinear I first tried building a &quot;tuned&quot; version of libsvm by making it multicore (-fopenmp and #pragma ... - as spelled out in the libsvm FAQ).&nbsp; I also added the appropriate -march and -mtune to CFLAGS.&nbsp; Not much difference except\r\n that it cranked my CPU usage from 100% to 200% because of openmp (it would have been 400%, but the other 2 cores are currently very busy crunching HHP data so I set OMP_NUM_THREADS=2).&nbsp; In any case it still looked like it would run forever.</p>\r\n<p>After reading a little more about libsvm, it seemed like there might be a data scaling problem that was preventing convergence.&nbsp; I had the same problem with my own SVM implementation way back when, and as a result mine scales the data by default (although\r\n there is a command-line flag to leave it unscaled).&nbsp; I wrongly assumed that libsvm would behave the same way.&nbsp; Not very bright of me.&nbsp; My solution: Create a modified version of runLeaderboardEval.pl that uses svm-scale on both the train and test data.</p>\r\n<p>The result: svm-train finished in 18 minutes using 2 cores (although with a plethora of &quot;Warning: using -h 0 may be faster&quot; messages).&nbsp; I'll check the data to make sure it makes sense, but for now this seems to have solved my problem.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 5885,
      "author_name": "pprett",
      "author_url": "",
      "post_date": "10/04/2011 07:47:12",
      "content": "<p>I have the same issue with libsvm; Furthermore, using probabilities make the runtime even worse. I now use liblinear for my submissions, instead of probabilities I submit the confidence scores - this is really fast (less than a minute) and gives comparable\r\n results (though libsvm and liblinear optimize slightly different objective functions)</p>\r\n<p>best, <br>\r\nPeter</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 6004,
      "author_name": "clueless0",
      "author_url": "",
      "post_date": "10/10/2011 20:38:01",
      "content": "<p>I just got started on this a few days ago, so I'm a bit behind the curve...</p>\r\n<p>Did anybody &quot;solve&quot; the svm-train run-time problem, or at least determine whether or not this is normal behavior?</p>\r\n<p>I ask because, like the original poster, I have a decent quad-core processor and adequate memory, but svm-train seems to be taking forever; nearing an hour at the moment, which seems extreme for 50,000 samples.&nbsp; I don't usually use libsvm - I wrote my own\r\n kernel machine library/utilities years ago - but I'm trying not to stray too far off the path due to the severe time constraint.&nbsp; And learning how to use a new tool is rarely a bad thing.</p>\r\n<p>If it matters, the exact command (executed from the host's perl script) is:</p>\r\n<p><span style=\"font-family:courier new,courier\">svm-train -s 0 -t 0 -c 1.0 -b 1 tmp.train.txt tmp.model.txt</span></p>\r\n<p>Any advice or assistance is appreciated.&nbsp; Otherwise I guess I'll just let it run until it either completes or dies.</p>\r\n<p>------------------</p>\r\n<p>Update: 3 hours and counting?&nbsp; What the heck?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 6009,
      "author_name": "chefele",
      "author_url": "",
      "post_date": "10/11/2011 01:39:28",
      "content": "<p>I'm at 48 hours of runtime for libsvm &amp; counting, just trying to recreate the K-means results described on the &quot;<em>Benchmark minibatch k-means, step by step&quot;</em> thread. This is pretty ridiculous. (I also wonder, how did libsvm get picked for this contest\r\n if the runtime is this bad?) Anyway, I'm going to try liblinear tonight on a different core (specifically, the LiblineaR package in R).</p>\r\n<p>UPDATE: I tried LiblineaR &amp; it's much much faster, just like Peter reported above (1 to 2 minutes on the 50k rows).&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 6010,
      "author_name": "argv",
      "author_url": "",
      "post_date": "10/11/2011 02:02:38",
      "content": "<p>Wow, that's terrible. Libsvm ran in about 10 minutes on my laptop, so we thought it would be okay for general use.\r\n</p>\r\n<p>I'll do some comparison tests with liblinear tomorrow to make sure the results are consistent with libsvm, and assuming they are it should be fine to use either package.\r\n</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 6016,
      "author_name": "clueless0",
      "author_url": "",
      "post_date": "10/11/2011 05:09:42",
      "content": "<p>Another update: I don't have Chris' patience, so I killed svm-train after 5 hours.</p>\r\n<p>Rather than skip right to liblinear I first tried building a &quot;tuned&quot; version of libsvm by making it multicore (-fopenmp and #pragma ... - as spelled out in the libsvm FAQ).&nbsp; I also added the appropriate -march and -mtune to CFLAGS.&nbsp; Not much difference except\r\n that it cranked my CPU usage from 100% to 200% because of openmp (it would have been 400%, but the other 2 cores are currently very busy crunching HHP data so I set OMP_NUM_THREADS=2).&nbsp; In any case it still looked like it would run forever.</p>\r\n<p>After reading a little more about libsvm, it seemed like there might be a data scaling problem that was preventing convergence.&nbsp; I had the same problem with my own SVM implementation way back when, and as a result mine scales the data by default (although\r\n there is a command-line flag to leave it unscaled).&nbsp; I wrongly assumed that libsvm would behave the same way.&nbsp; Not very bright of me.&nbsp; My solution: Create a modified version of runLeaderboardEval.pl that uses svm-scale on both the train and test data.</p>\r\n<p>The result: svm-train finished in 18 minutes using 2 cores (although with a plethora of &quot;Warning: using -h 0 may be faster&quot; messages).&nbsp; I'll check the data to make sure it makes sense, but for now this seems to have solved my problem.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "5881": "",
    "5885": "",
    "6004": "",
    "6009": "",
    "6010": "",
    "6016": ""
  },
  "source": "meta"
}