title: R gbm logistic regression
body: <p>I was hoping to use the <code>GBM</code> package to do logistic regression, but it is giving answers slightly outside of the 0-1 range.  I've tried the suggested distribution parameters for 0-1 predictions (<code>bernoulli</code>, and <code>adaboost</code>) but that actually makes things worse than using <code>gaussian</code>.</p>
  
  <pre><code>GBM_NTREES = 150
  GBM_SHRINKAGE = 0.1
  GBM_DEPTH = 4
  GBM_MINOBS = 50
  &gt; GBM_model &lt;- gbm.fit(
  + x = trainDescr 
  + ,y = trainClass 
  + ,distribution = "gaussian"
  + ,n.trees = GBM_NTREES
  + ,shrinkage = GBM_SHRINKAGE
  + ,interaction.depth = GBM_DEPTH
  + ,n.minobsinnode = GBM_MINOBS
  + ,verbose = TRUE)
  Iter   TrainDeviance   ValidDeviance   StepSize   Improve
       1        0.0603             nan     0.1000    0.0019
       2        0.0588             nan     0.1000    0.0016
       3        0.0575             nan     0.1000    0.0013
       4        0.0563             nan     0.1000    0.0011
       5        0.0553             nan     0.1000    0.0010
       6        0.0546             nan     0.1000    0.0008
       7        0.0539             nan     0.1000    0.0007
       8        0.0533             nan     0.1000    0.0006
       9        0.0528             nan     0.1000    0.0005
      10        0.0524             nan     0.1000    0.0004
     100        0.0484             nan     0.1000    0.0000
     150        0.0481             nan     0.1000   -0.0000
  &gt; prediction &lt;- predict.gbm(object = GBM_model
  + ,newdata = testDescr
  + ,GBM_NTREES)
  &gt; hist(prediction)
  &gt; range(prediction)
  [1] -0.02945224  1.00706700
  </code></pre>
  
  <p>Bernoulli:</p>
  
  <pre><code>GBM_model &lt;- gbm.fit(
  x = trainDescr 
  ,y = trainClass 
  ,distribution = "bernoulli"
  ,n.trees = GBM_NTREES
  ,shrinkage = GBM_SHRINKAGE
  ,interaction.depth = GBM_DEPTH
  ,n.minobsinnode = GBM_MINOBS
  ,verbose = TRUE)
  prediction &lt;- predict.gbm(object = GBM_model
  + ,newdata = testDescr
  + ,GBM_NTREES)
  &gt; hist(prediction)
  &gt; range(prediction)
  [1] -4.699324  3.043440
  </code></pre>
  
  <p>And adaboost:</p>
  
  <pre><code>GBM_model &lt;- gbm.fit(
  x = trainDescr 
  ,y = trainClass 
  ,distribution = "adaboost"
  ,n.trees = GBM_NTREES
  ,shrinkage = GBM_SHRINKAGE
  ,interaction.depth = GBM_DEPTH
  ,n.minobsinnode = GBM_MINOBS
  ,verbose = TRUE)
  &gt; prediction &lt;- predict.gbm(object = GBM_model
  + ,newdata = testDescr
  + ,GBM_NTREES)
  &gt; hist(prediction)
  &gt; range(prediction)
  [1] -3.0374228  0.9323279
  </code></pre>
  
  <p>Am I doing something wrong, do I need to preProcess (scale, center) the data or do I need to go in and manually floor/cap the values with something like :</p>
  
  <pre><code>prediction &lt;- ifelse(prediction &lt; 0, 0, prediction)
  prediction &lt;- ifelse(prediction &gt; 1, 1, prediction)
  </code></pre>