{
  "id": 718,
  "title": "Memory problems with reading the train set file with the R language.",
  "url": "/competitions/ClaimPredictionChallenge/discussion/718",
  "author_name": "",
  "post_date": "2011-07-18T14:05:02.477Z",
  "votes": null,
  "comment_count": 13,
  "views": 15871,
  "content": "<p>I tried to read the train_set by the commands</p>\r\n<p>memory.limit(4095)</p>\r\n<p>aaa&lt;-read.csv(file=&quot;train_set.csv&quot;)</p>\r\n<p>Unfortunately I get the error cannot allocate a vector of size&nbsp;62.5&nbsp;M</p>\r\n<p><span class=\"x_Apple-style-span\" style=\"\">&quot;If 32-bit<span class=\"x_Apple-converted-space\">&nbsp;</span><span style=\"font-family:Courier New,Courier; color:#666666\"><strong>R</strong></span><span class=\"x_Apple-converted-space\">&nbsp;</span>is run on most 64-bit versions\r\n of Windows the maximum value of obtainable memory is just under 4Gb. For a 64-bit versions of<span class=\"x_Apple-converted-space\">&nbsp;</span><span style=\"font-family:Courier New,Courier; color:#666666\"><strong>R</strong></span><span class=\"x_Apple-converted-space\">&nbsp;</span>under\r\n 64-bit Windows the limit is currently 8Tb.&quot;</span></p>\r\n<p>4 Gb and 8 Tb is a big difference and I wonder if people who use R for this competition use only&nbsp;64 bit versions of R under&nbsp;64 bit Windows.&nbsp;</p>",
  "messages": [
    {
      "id": "4642",
      "postDate": "07/18/2011 14:05:02",
      "content": "<p>I tried to read the train_set by the commands</p>\r\n<p>memory.limit(4095)</p>\r\n<p>aaa&lt;-read.csv(file=&quot;train_set.csv&quot;)</p>\r\n<p>Unfortunately I get the error cannot allocate a vector of size&nbsp;62.5&nbsp;M</p>\r\n<p><span class=\"x_Apple-style-span\" style=\"\">&quot;If 32-bit<span class=\"x_Apple-converted-space\">&nbsp;</span><span style=\"font-family:Courier New,Courier; color:#666666\"><strong>R</strong></span><span class=\"x_Apple-converted-space\">&nbsp;</span>is run on most 64-bit versions\r\n of Windows the maximum value of obtainable memory is just under 4Gb. For a 64-bit versions of<span class=\"x_Apple-converted-space\">&nbsp;</span><span style=\"font-family:Courier New,Courier; color:#666666\"><strong>R</strong></span><span class=\"x_Apple-converted-space\">&nbsp;</span>under\r\n 64-bit Windows the limit is currently 8Tb.&quot;</span></p>\r\n<p>4 Gb and 8 Tb is a big difference and I wonder if people who use R for this competition use only&nbsp;64 bit versions of R under&nbsp;64 bit Windows.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4643",
      "postDate": "07/18/2011 18:10:18",
      "content": "<p>Yes Uri, you would need 64bit operating system and and a large amount of RAM.</p>\r\n<p>Other options (in order of my preference) you have ( &amp; which I found practical in handling large datasets)</p>\r\n<p>1. Find a 64 bit OS with RAM 2-3 times the size of the dataset.</p>\r\n<p>2. Make use of SQL Server Express/MySQL database and use R 32bit on 32bit OS (if not #1) to explore data by brining in only the columns you need to do your analysis.</p>\r\n<p>3. Use cloud serves such as Amazon EC2, where you can get access to upto 68GB RAM 64bit machines for ~$2.5/hours. (if you want more details about how to setup your cloud machine let me know)</p>\r\n<p>4. Use some R packages for out of memory analysis - but I could not get them to work the way I wanted.</p>\r\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4651",
      "postDate": "07/19/2011 16:57:38",
      "content": "<p>so far the immense size of the training and test sets have been the biggest obstacle.</p>\r\n<p>i am using an Amazon EC2 with 17GB, and i am still hitting memory limits and find myself having to be careful how i handle the data and process it in batches as opposed to all at once.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4652",
      "postDate": "07/19/2011 17:15:47",
      "content": "<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4658",
      "postDate": "07/19/2011 22:22:04",
      "content": "<p>I am trying to set up a SQL 2008 R2 instance using Amazon EC2, but I can't figure out what to put in for the server name? I just want a local environment where I can run the data through analysis services. Any tips?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4671",
      "postDate": "07/21/2011 00:49:43",
      "content": "<p>[quote=Tom Seward;4658]</p>\r\n<p>I am trying to set up a SQL 2008 R2 instance using Amazon EC2, but I can't figure out what to put in for the server name?</p>\r\n<p>[/quote]</p>\r\n<p>When you select the EC2 instance the lower panel will have a value titled &quot;<span class=\"x_label\" style=\"width:180px\"><span id=\"x_instances_main_public_dns\" class=\"x_console-tooltip\">Public DNS&quot;. That is the name of the server. Also, you have to ensure that\r\n the security group has the SQL Server port open</span></span>, which by default is 1433.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4680",
      "postDate": "07/21/2011 19:30:54",
      "content": "<p>R has prohibitive memory consumption. You should use a tool that is more memory efficient: for example: the &quot;TIMi Suite&quot;. See you! Frank</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4729",
      "postDate": "07/25/2011 15:54:25",
      "content": "<p>On a 64bit Windows system, with Revolution R 64 bit, this works for me (I have 8GB of RAM, not sure if this might become a bottleneck for you) It takes a few minutes to read in from CSV, but the read in from xdf is couple of seconds at most... once you have\r\n the dataframe, you can export it to whatever you wanna use this data in - note that all car charactersitics will be the same for the same submodel, so you can effectively break the table in 2, a look up and the main - making the data transfer to other programs\r\n smaller.</p>\r\n<p>rxTextToXdf( inFile = &quot;C:\\Users\\InsuranceContest\\train<em>set.csv&quot;, <br>\r\noutFile = &quot;C:\\Users\\InsuranceContest\\train</em>set.xdf&quot;, rowSelection = NULL, <br>\r\ntransforms = NULL, append = &quot;none&quot;, overwrite = FALSE, <br>\r\nstringsAsFactors = TRUE, columnDelimiters = NULL,<br>\r\nrowsPerRead = 500000)</p>\r\n<p>data &lt;- rxXdfToDataFrame(file = &quot;C:\\Users\\InsuranceContest\\train_set.xdf&quot;, varsToKeep = NULL, varsToDrop = NULL, rowVarName = NULL,\r\n<br>\r\nrowSelection = NULL, transforms = NULL, blocksPerRead = 1, reportProgress = 2, maxRowsByCols = 9e&#43;09)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4730",
      "postDate": "07/25/2011 16:04:01",
      "content": "<p>&quot;note that all car charactersitics will be the same for the same submodel&quot;</p>\r\n<p>Maybe this observation will help with modeling (model on a smaller, summarized dataset), and not just data transfer?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4837",
      "postDate": "08/01/2011 10:43:51",
      "content": "<p>[quote=Jeremy Howard (Kaggle);4652]</p>\r\n<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>\r\n<p>[/quote]</p>\r\n<p>I do not understand how Revolution R helps to read big data.</p>\r\n<p>page 20 of RevoScaleRGetStart.pdf gives the following as an example</p>\r\n<p>testDF &lt;- rxReadXdf(file=dataName, varsToKeep = c(&quot;ArrDelay&quot;, &quot;DepDelay&quot;, &quot;DayOfWeek&quot;), startRow = 100000, numRows = 1000)</p>\r\n<p>summary(testDF)</p>\r\n<p>I read that I should be able to analyze also data that is too big to fit into memory by using RevoScaleR functions but I&nbsp;do not understand how I can do it</p>\r\n<p>I am not interested in regression but only in the same details that I get with summary(testDF) and in the ability to have big vectors like testDF$Row_ID that I can do calculations on them.</p>\r\n<p>I wonder if there is a good way to do it without installing 64 bits window or maybe if I install 64 bit windows I can simply write something like memory.limit(100000) that is going to solve all the problems</p>\r\n<p>with 32 bits I can write at most&nbsp;memory.limit(4095) without getting an error.</p>\r\n<p>I guess that more RAM can also help but the computer has no limit of&nbsp;4095 mbytes even if it has no more RAM than it and I think that&nbsp;practically there should be no problem with arrays of 100,000 mbytes considering the fact that the computer clearly has enough\r\n memory not in RAM for it.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4871",
      "postDate": "08/02/2011 04:02:05",
      "content": "<p>[quote=Uri Blass;4837]</p>\r\n<p>I do not understand how Revolution R helps to read big data.</p>\r\n<p>[/quote]</p>\r\n<p>The RevoScaleR getting started guide introduces functions such as rxSummary, rxHistogram, rxLinMod, rxLinePlot, rxCrossTabs etc. For example using rxSummary(~., data=&quot;traindata&quot;) will produce univariate summaries for each variable if you have the file traindata.xdf\r\n in your working directory. You first need to convert the csv file to a xdf file using rxTextToXdf.</p>\r\n<p>I must admit I've thrown the towel in with my 32bit windows on an old machine, but Revolution R seems like a great tool for out-of-memory operations. Incidentally, my one submission (team smidsy 0.038) can be seen as a benchmark: it's what you get if you\r\n take the Blind_Model averages as the predictions (which overfits).</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "4916",
      "postDate": "08/04/2011 02:21:12",
      "content": "<p>Hi,</p>\r\n<p>Using RevoScaleR from Revolution Analytics, I was able to read the training set into an XDF file, which is their file format. I barely have 1 GB RAM in my trusty Acer Netbook runing Windows XP Home Edition.&nbsp;</p>\r\n<p>So far, so good.</p>\r\n<p>Jan</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "5989",
      "postDate": "10/10/2011 14:06:29",
      "content": "<p>Thanks for this tip,&nbsp;I've been looking for the Revolution R link on the URL <em>\r\nwww.kaggle.com.</em></p>\r\n<p>It's probably just me, but I can't seem to spot it, can you help ?&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Many thanks.</p>\r\n<p><em><br>\r\n</em></p>\r\n<p>&nbsp;</p>\r\n<p><em><br>\r\n</em></p>\r\n<p>&nbsp;</p>\r\n<p>[quote=Jeremy Howard (Kaggle);4652]</p>\r\n<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>\r\n<p>[/quote]</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "5990",
      "postDate": "10/10/2011 14:36:26",
      "content": "<p>I know I saw it before, but don't see the link now, but this one works:</p>\r\n<p>http://info.revolutionanalytics.com/Kaggle.html</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 4643,
      "author_name": "sashikanthdareddy",
      "author_url": "",
      "post_date": "07/18/2011 18:10:18",
      "content": "<p>Yes Uri, you would need 64bit operating system and and a large amount of RAM.</p>\r\n<p>Other options (in order of my preference) you have ( &amp; which I found practical in handling large datasets)</p>\r\n<p>1. Find a 64 bit OS with RAM 2-3 times the size of the dataset.</p>\r\n<p>2. Make use of SQL Server Express/MySQL database and use R 32bit on 32bit OS (if not #1) to explore data by brining in only the columns you need to do your analysis.</p>\r\n<p>3. Use cloud serves such as Amazon EC2, where you can get access to upto 68GB RAM 64bit machines for ~$2.5/hours. (if you want more details about how to setup your cloud machine let me know)</p>\r\n<p>4. Use some R packages for out of memory analysis - but I could not get them to work the way I wanted.</p>\r\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4651,
      "author_name": "markwaddle",
      "author_url": "",
      "post_date": "07/19/2011 16:57:38",
      "content": "<p>so far the immense size of the training and test sets have been the biggest obstacle.</p>\r\n<p>i am using an Amazon EC2 with 17GB, and i am still hitting memory limits and find myself having to be careful how i handle the data and process it in batches as opposed to all at once.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4652,
      "author_name": "jhoward",
      "author_url": "",
      "post_date": "07/19/2011 17:15:47",
      "content": "<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4658,
      "author_name": "tomseward",
      "author_url": "",
      "post_date": "07/19/2011 22:22:04",
      "content": "<p>I am trying to set up a SQL 2008 R2 instance using Amazon EC2, but I can't figure out what to put in for the server name? I just want a local environment where I can run the data through analysis services. Any tips?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4671,
      "author_name": "markwaddle",
      "author_url": "",
      "post_date": "07/21/2011 00:49:43",
      "content": "<p>[quote=Tom Seward;4658]</p>\r\n<p>I am trying to set up a SQL 2008 R2 instance using Amazon EC2, but I can't figure out what to put in for the server name?</p>\r\n<p>[/quote]</p>\r\n<p>When you select the EC2 instance the lower panel will have a value titled &quot;<span class=\"x_label\" style=\"width:180px\"><span id=\"x_instances_main_public_dns\" class=\"x_console-tooltip\">Public DNS&quot;. That is the name of the server. Also, you have to ensure that\r\n the security group has the SQL Server port open</span></span>, which by default is 1433.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4680,
      "author_name": "frank913",
      "author_url": "",
      "post_date": "07/21/2011 19:30:54",
      "content": "<p>R has prohibitive memory consumption. You should use a tool that is more memory efficient: for example: the &quot;TIMi Suite&quot;. See you! Frank</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4729,
      "author_name": "",
      "author_url": "",
      "post_date": "07/25/2011 15:54:25",
      "content": "<p>On a 64bit Windows system, with Revolution R 64 bit, this works for me (I have 8GB of RAM, not sure if this might become a bottleneck for you) It takes a few minutes to read in from CSV, but the read in from xdf is couple of seconds at most... once you have\r\n the dataframe, you can export it to whatever you wanna use this data in - note that all car charactersitics will be the same for the same submodel, so you can effectively break the table in 2, a look up and the main - making the data transfer to other programs\r\n smaller.</p>\r\n<p>rxTextToXdf( inFile = &quot;C:\\Users\\InsuranceContest\\train<em>set.csv&quot;, <br>\r\noutFile = &quot;C:\\Users\\InsuranceContest\\train</em>set.xdf&quot;, rowSelection = NULL, <br>\r\ntransforms = NULL, append = &quot;none&quot;, overwrite = FALSE, <br>\r\nstringsAsFactors = TRUE, columnDelimiters = NULL,<br>\r\nrowsPerRead = 500000)</p>\r\n<p>data &lt;- rxXdfToDataFrame(file = &quot;C:\\Users\\InsuranceContest\\train_set.xdf&quot;, varsToKeep = NULL, varsToDrop = NULL, rowVarName = NULL,\r\n<br>\r\nrowSelection = NULL, transforms = NULL, blocksPerRead = 1, reportProgress = 2, maxRowsByCols = 9e&#43;09)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4730,
      "author_name": "allstateinsurancecompany",
      "author_url": "",
      "post_date": "07/25/2011 16:04:01",
      "content": "<p>&quot;note that all car charactersitics will be the same for the same submodel&quot;</p>\r\n<p>Maybe this observation will help with modeling (model on a smaller, summarized dataset), and not just data transfer?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4837,
      "author_name": "uriblass",
      "author_url": "",
      "post_date": "08/01/2011 10:43:51",
      "content": "<p>[quote=Jeremy Howard (Kaggle);4652]</p>\r\n<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>\r\n<p>[/quote]</p>\r\n<p>I do not understand how Revolution R helps to read big data.</p>\r\n<p>page 20 of RevoScaleRGetStart.pdf gives the following as an example</p>\r\n<p>testDF &lt;- rxReadXdf(file=dataName, varsToKeep = c(&quot;ArrDelay&quot;, &quot;DepDelay&quot;, &quot;DayOfWeek&quot;), startRow = 100000, numRows = 1000)</p>\r\n<p>summary(testDF)</p>\r\n<p>I read that I should be able to analyze also data that is too big to fit into memory by using RevoScaleR functions but I&nbsp;do not understand how I can do it</p>\r\n<p>I am not interested in regression but only in the same details that I get with summary(testDF) and in the ability to have big vectors like testDF$Row_ID that I can do calculations on them.</p>\r\n<p>I wonder if there is a good way to do it without installing 64 bits window or maybe if I install 64 bit windows I can simply write something like memory.limit(100000) that is going to solve all the problems</p>\r\n<p>with 32 bits I can write at most&nbsp;memory.limit(4095) without getting an error.</p>\r\n<p>I guess that more RAM can also help but the computer has no limit of&nbsp;4095 mbytes even if it has no more RAM than it and I think that&nbsp;practically there should be no problem with arrays of 100,000 mbytes considering the fact that the computer clearly has enough\r\n memory not in RAM for it.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4871,
      "author_name": "alecstephenson",
      "author_url": "",
      "post_date": "08/02/2011 04:02:05",
      "content": "<p>[quote=Uri Blass;4837]</p>\r\n<p>I do not understand how Revolution R helps to read big data.</p>\r\n<p>[/quote]</p>\r\n<p>The RevoScaleR getting started guide introduces functions such as rxSummary, rxHistogram, rxLinMod, rxLinePlot, rxCrossTabs etc. For example using rxSummary(~., data=&quot;traindata&quot;) will produce univariate summaries for each variable if you have the file traindata.xdf\r\n in your working directory. You first need to convert the csv file to a xdf file using rxTextToXdf.</p>\r\n<p>I must admit I've thrown the towel in with my 32bit windows on an old machine, but Revolution R seems like a great tool for out-of-memory operations. Incidentally, my one submission (team smidsy 0.038) can be seen as a benchmark: it's what you get if you\r\n take the Blind_Model averages as the predictions (which overfits).</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 4916,
      "author_name": "janko6362",
      "author_url": "",
      "post_date": "08/04/2011 02:21:12",
      "content": "<p>Hi,</p>\r\n<p>Using RevoScaleR from Revolution Analytics, I was able to read the training set into an XDF file, which is their file format. I barely have 1 GB RAM in my trusty Acer Netbook runing Windows XP Home Edition.&nbsp;</p>\r\n<p>So far, so good.</p>\r\n<p>Jan</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 5989,
      "author_name": "imagedoctor",
      "author_url": "",
      "post_date": "10/10/2011 14:06:29",
      "content": "<p>Thanks for this tip,&nbsp;I've been looking for the Revolution R link on the URL <em>\r\nwww.kaggle.com.</em></p>\r\n<p>It's probably just me, but I can't seem to spot it, can you help ?&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Many thanks.</p>\r\n<p><em><br>\r\n</em></p>\r\n<p>&nbsp;</p>\r\n<p><em><br>\r\n</em></p>\r\n<p>&nbsp;</p>\r\n<p>[quote=Jeremy Howard (Kaggle);4652]</p>\r\n<p>A couple of other options: use the big data features of Revolution R, which is available free to Kaggle competitors (see the link on Kaggle's home page) - this software has various libraries and features that allow really big data sets to be handled, even\r\n if they don't fit in memory. Another approach is to filter out some of the data using a simple DB (e.g. sqlite is a good choice) - there's a\r\n<em>lot</em> of rows where the dependent variable is zero; I bet randomly removing a bunch of them won't really impact your model at all, but will make it much easier to analyse.</p>\r\n<p>[/quote]</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 5990,
      "author_name": "chrisraimondi",
      "author_url": "",
      "post_date": "10/10/2011 14:36:26",
      "content": "<p>I know I saw it before, but don't see the link now, but this one works:</p>\r\n<p>http://info.revolutionanalytics.com/Kaggle.html</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "4642": "",
    "4643": "",
    "4651": "",
    "4652": "",
    "4658": "",
    "4671": "",
    "4680": "",
    "4729": "",
    "4730": "",
    "4837": "",
    "4871": "",
    "4916": "",
    "5989": "",
    "5990": ""
  },
  "source": "meta"
}