{
  "id": 12822,
  "title": "Plot the digits using average of the corresponding pixels",
  "url": "/competitions/digit-recognizer/discussion/12822",
  "author_name": "Brainalytics",
  "post_date": "2015-03-15T20:36:18.710000",
  "votes": 1,
  "comment_count": 1,
  "views": null,
  "content": "<p># Load the data<br>setwd(&quot;&quot;)<br>train &lt;- read.csv(&quot;train.csv&quot;, header = TRUE)<br>df &lt;- train[0,]</p>\n<p># Compute the Average of Pixels<br>for(i in 0:(length(unique(train$label))-1)){<br> digit = i<br> temp &lt;- train[train$label==digit,]<br> df &lt;- rbind(df, t(round(colMeans(temp))))<br>}</p>\n<p>#Plot the images using the pixel values<br>par(mfrow=c(2,5))<br>for(i in 1:nrow(df)){<br> n = matrix(as.numeric(df[i,2:ncol(df)])/256,28,28,byrow=TRUE)<br> image(n, axes = FALSE, col = grey(seq(0, 1, length = 256)),xlab=df[i,1])<br>}</p>",
  "messages": [
    {
      "id": 66275,
      "postDate": "2015-03-15T20:36:18.710Z",
      "content": "<p># Load the data<br>setwd(&quot;&quot;)<br>train &lt;- read.csv(&quot;train.csv&quot;, header = TRUE)<br>df &lt;- train[0,]</p>\n<p># Compute the Average of Pixels<br>for(i in 0:(length(unique(train$label))-1)){<br> digit = i<br> temp &lt;- train[train$label==digit,]<br> df &lt;- rbind(df, t(round(colMeans(temp))))<br>}</p>\n<p>#Plot the images using the pixel values<br>par(mfrow=c(2,5))<br>for(i in 1:nrow(df)){<br> n = matrix(as.numeric(df[i,2:ncol(df)])/256,28,28,byrow=TRUE)<br> image(n, axes = FALSE, col = grey(seq(0, 1, length = 256)),xlab=df[i,1])<br>}</p>",
      "votes": 1
    },
    {
      "id": 174164,
      "postDate": "2017-04-10T15:00:28.700Z",
      "content": "<p>How would you plot 100 digits on the same plot ?</p>",
      "rawMarkdown": "How would you plot 100 digits on the same plot ?"
    }
  ],
  "comments": [
    {
      "id": 174164,
      "author_name": "NicoCoallier",
      "author_url": "",
      "post_date": "2017-04-10T15:00:28.700000",
      "content": "<p>How would you plot 100 digits on the same plot ?</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "66275": "",
    "174164": "How would you plot 100 digits on the same plot ?"
  }
}