title: how to calculate GBM accuracy in r
body: <p>I used the gbm() function to create the model and I want to get the accuracy. Here is my code:</p>
  
  <pre><code>df&lt;-read.csv("http://freakonometrics.free.fr/german_credit.csv", header=TRUE)
  
  str(df)
  
  F=c(1,2,4,5,7,8,9,10,11,12,13,15,16,17,18,19,20,21)
  for(i in F) df[,i]=as.factor(df[,i])
  
  library(caret)
  
  set.seed(1000)
  intrain&lt;-createDataPartition(y=df$Creditability, p=0.7, list=FALSE)
  train&lt;-df[intrain, ]
  test&lt;-df[-intrain, ]
  
  install.packages("gbm")
  library("gbm")
  
  df_boosting&lt;-gbm(Creditability~.,distribution = "bernoulli", n.trees=100, verbose=TRUE, interaction.depth=4,
                   shrinkage=0.01, data=train)
  summary(df_boosting)
  
  yhat.boost&lt;-predict (df_boosting ,newdata =test, n.trees=100)
  mean((yhat.boost-test$Creditability)^2) 
  </code></pre>
  
  <p>However, when using the summary function, an error appears. The error message is as follows.</p>
  
  <pre><code>Error in plot.window(xlim, ylim, log = log, ...) : 
    유한한 값들만이 'xlim'에 사용될 수 있습니다
  In addition: Warning messages:
  1: In min(x) : no non-missing arguments to min; returning Inf
  2: In max(x) : no non-missing arguments to max; returning -Inf
  </code></pre>
  
  <p>And, When measuring the MSE with the mean function, the following error also appears:</p>
  
  <pre><code>Warning message:
  In Ops.factor(yhat.boost, test$Creditability) :
    요인(factors)에 대하여 의미있는 ‘-’가 아닙니다.
  </code></pre>
  
  <p>Do you know why these two errors appear? Thank you in advance.</p>