[R] Enable weighted learning to rank (#5945)

* [R] enable weighted learning to rank

* Add R unit test for ranking

* Fix lint
This commit is contained in:
Philip Hyunsu Cho
2020-07-26 21:10:36 -07:00
committed by GitHub
parent ace7fd328b
commit 6347fa1c2e
2 changed files with 51 additions and 2 deletions

View File

@@ -257,8 +257,6 @@ setinfo.xgb.DMatrix <- function(object, name, info, ...) {
return(TRUE)
}
if (name == "weight") {
if (length(info) != nrow(object))
stop("The length of weights must equal to the number of rows in the input data")
.Call(XGDMatrixSetInfo_R, object, name, as.numeric(info))
return(TRUE)
}