new nrow function for xgb.DMatrix
This commit is contained in:
parent
cdfa78a3b9
commit
81caba5dce
@ -16,6 +16,7 @@ export(xgb.save)
|
|||||||
export(xgb.save.raw)
|
export(xgb.save.raw)
|
||||||
export(xgb.train)
|
export(xgb.train)
|
||||||
export(xgboost)
|
export(xgboost)
|
||||||
|
exportMethods(nrow)
|
||||||
exportMethods(predict)
|
exportMethods(predict)
|
||||||
import(methods)
|
import(methods)
|
||||||
importClassesFrom(Matrix,dgCMatrix)
|
importClassesFrom(Matrix,dgCMatrix)
|
||||||
@ -52,4 +53,3 @@ importFrom(stringr,str_match)
|
|||||||
importFrom(stringr,str_replace)
|
importFrom(stringr,str_replace)
|
||||||
importFrom(stringr,str_split)
|
importFrom(stringr,str_split)
|
||||||
importFrom(stringr,str_trim)
|
importFrom(stringr,str_trim)
|
||||||
import(vcd)
|
|
||||||
|
|||||||
18
R-package/R/nrow.xgb.DMatrix.R
Normal file
18
R-package/R/nrow.xgb.DMatrix.R
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
setGeneric("nrow")
|
||||||
|
|
||||||
|
#' @param x Object of class \code{xgb.DMatrix}
|
||||||
|
#' @title \code{nrow} return the number of rows present in x.
|
||||||
|
#' @rdname nrow
|
||||||
|
#' @examples
|
||||||
|
#' data(agaricus.train, package='xgboost')
|
||||||
|
#' train <- agaricus.train
|
||||||
|
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
|
||||||
|
#' stopifnot(nrow(dtrain) == nrow(train$data))
|
||||||
|
#'
|
||||||
|
#' @export
|
||||||
|
setMethod("nrow",
|
||||||
|
signature = "xgb.DMatrix",
|
||||||
|
definition = function(x) {
|
||||||
|
xgb.numrow(x)
|
||||||
|
}
|
||||||
|
)
|
||||||
22
R-package/man/nrow.Rd
Normal file
22
R-package/man/nrow.Rd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
% Generated by roxygen2 (4.1.0): do not edit by hand
|
||||||
|
% Please edit documentation in R/nrow.xgb.DMatrix.R
|
||||||
|
\docType{methods}
|
||||||
|
\name{nrow,xgb.DMatrix-method}
|
||||||
|
\alias{nrow,xgb.DMatrix-method}
|
||||||
|
\title{\code{nrow} return the number of rows present in x.}
|
||||||
|
\usage{
|
||||||
|
\S4method{nrow}{xgb.DMatrix}(x)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{x}{Object of class \code{xgb.DMatrix}}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
\code{nrow} return the number of rows present in x.
|
||||||
|
}
|
||||||
|
\examples{
|
||||||
|
data(agaricus.train, package='xgboost')
|
||||||
|
train <- agaricus.train
|
||||||
|
dtrain <- xgb.DMatrix(train$data, label=train$label)
|
||||||
|
stopifnot(nrow(dtrain) == nrow(train$data))
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user