2016-12-23 8 views
0

저는 R에 익숙하지 않고 XGBoost 기능에 약간의 문제가 있습니다.XGBoost 설정에 오류가 있습니다.

test_rows <- sample.int(nrow(ccdata), nrow(ccdata)/3) 
test <- ccdata[test_rows,] 
train <- ccdata[-test_rows,] 
table(test$default.payment.next.month) 
table(train$default.payment.next.month) 

bstSparse <- xgboost(data = train, label = train$default.payment.next.month, max.depth = 2, eta = 1, nthread = 2, nround = 2, objective = "binary:logistic") 

그리고 다음과 같은 오류를 받고 있어요 : 사람이 어떤 조언을 가지고

Error in xgb.get.DMatrix(data, label, missing, weight) : 
xgboost only support numerical matrix input, 
     use 'data.matrix' to transform the data. 
In addition: Warning message: 
In xgb.get.DMatrix(data, label, missing, weight) : 
xgboost: label will be ignored. 

경우가 크게 감상 할 수있다 이것은 내가 지금까지 가지고있는 코드입니다.

많은 감사

답변

2

오류 메시지는 당신의 단서입니다. XGBoost는 숫자 형식 및 매트릭스 형식의 데이터 만 허용합니다. 데이터 프레임을 먹고있는 것처럼 보입니까? as.matrix (test) 및 as.matrix (train)를 사용해보십시오. str (객체)를 사용하여 객체의 본질을 검사하여 그 객체가 무엇인지 확인할 수 있습니다.