[R] regarding predicted value from xgboost package
Ranjana Girish
ranjanagirish30 at gmail.com
Fri Oct 14 07:27:34 CEST 2016
hai everyone.....
i am using model building function xgboost() using code :
fit <- xgboost(data =sparse_matrix , label = trainSet$OutputClass,
max.depth = 4,eta = 1, nthread = 2, nround = 10, eval_metric =
"merror",objective = "multi:softmax",num_class = 45)
when i use the prediction function:
Prediction <- predict(fit,sparse_matrixtestSet)
the above code gave output as below( instead of class names its giving
numerical equivalent value eventhough "*label = trainSet$OutputClass*"
contain class names)
*output:*
[1] 1 1 1 1 1 35 3 3 3 4 31 7 7 7 3 3 9 9 9 9 9 9 9 10
10 11
[27] 11 11 11 11 11 11 11 11 11 13 13 13 13 13 13 13 13 13 14 14 14 14 14
14 10 10
[53] 15 15 15 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 16 16
18 18 18
[79] 18 18 18 18 35 35 35 18 21 21 21 21 32 1 1 25 25 25 25 26 27 27 27
27 27 27
[105] 27 27 29 29 29 29 29 30 30 30 30 30 30 30 30 30 30 35 35 32 32 32 43
43 32 32
[131] 32 32 32 32 32 32 43 32 32 32 32 32 33
i have also set *stringsAsFactors=FALSE* while reading data set
could some one please help, how to get prediction in term of class name
instead of numerical equivalent value.
Thanks in advance....
[[alternative HTML version deleted]]
More information about the R-help
mailing list