|
13 | 13 | ##' \item \code{multi:softprob} same as softmax, but prediction outputs a vector of ndata * nclass elements, which can be further reshaped to ndata, nclass matrix. The result contains predicted probabilities of each data point belonging to each class. |
14 | 14 | ##' \item \code{rank:pairwise} set xgboost to do ranking task by minimizing the pairwise loss. |
15 | 15 | ##' } |
16 | | -##' @param evalmetric evaluation metrics for validation data. Users can pass a self-defined function to it. |
17 | | -##' Default: metric will be assigned according to objective(rmse for regression, and error for classification, mean average precision for ranking). |
18 | | -##' List is provided in detail section. |
| 16 | +##' @param evalmetric evaluation metrics for validation data. Users can pass a self-defined function to it. Default: metric will be assigned according to objective(rmse for regression, and error for classification, mean average precision for ranking). |
| 17 | +##' \itemize{ |
| 18 | +##' \item \code{error} binary classification error rate |
| 19 | +##' \item \code{rmse} Rooted mean square error |
| 20 | +##' \item \code{logloss} negative log-likelihood function |
| 21 | +##' \item \code{auc} Area under curve |
| 22 | +##' \item \code{merror} Exact matching error, used to evaluate multi-class classification |
| 23 | +##' } |
19 | 24 | ##' @param n_folds K for cross Validation |
20 | 25 | ##' @param eta_range The range of eta(default is c(0.1, 1L)) |
21 | 26 | ##' @param max_depth_range The range of max_depth(default is c(4L, 6L)) |
@@ -114,7 +119,7 @@ xgb_cv_opt <- function(data, |
114 | 119 | } |
115 | 120 |
|
116 | 121 | #about classes |
117 | | - if (objectfun == "binary:logistic"){ |
| 122 | + if (grepl("logi", objectfun) == TRUE){ |
118 | 123 | xgb_cv <- function(object_fun, |
119 | 124 | eval_met, |
120 | 125 | num_classes, |
@@ -142,7 +147,7 @@ xgb_cv_opt <- function(data, |
142 | 147 | early_stopping_rounds = 5, maximize = TRUE, verbose = 0, |
143 | 148 | nrounds = nrounds_opt) |
144 | 149 |
|
145 | | - if (eval_met %in% c("auc", "logloss", "mlogloss")) { |
| 150 | + if (eval_met %in% c("auc", "ndcg", "map")) { |
146 | 151 | s <- max(cv$evaluation_log[, 4]) |
147 | 152 | } else { |
148 | 153 | s <- max(-(cv$evaluation_log[, 4])) |
@@ -181,7 +186,7 @@ xgb_cv_opt <- function(data, |
181 | 186 | early_stopping_rounds = 5, maximize = TRUE, verbose = 0, |
182 | 187 | nrounds = nrounds_opt) |
183 | 188 |
|
184 | | - if (eval_met %in% c("auc", "logloss", "mlogloss")) { |
| 189 | + if (eval_met %in% c("auc", "ndcg", "map")) { |
185 | 190 | s <- max(cv$evaluation_log[, 4]) |
186 | 191 | } else { |
187 | 192 | s <- max(-(cv$evaluation_log[, 4])) |
|
0 commit comments