xg_predict: Predict on new values

Description Usage Arguments Value Examples

View source: R/xgez.R

Description

xg_predict use the previously trained xgboost model to perform prediction on new data.

Usage

1
xg_predict(model, data)

Arguments

model

Object A model object created by the function xg_train.

data

data.frame. A data.frame or data.table structure with column names equal to the input names.

Value

The prediction with the following fields:

Examples

1
2
3
4
5
6
7
d <- xg_load_data(system.file("extdata", "titanic.csv", package = "ezXg"),
               inputs = c("Pclass", "Sex", "Age", "SibSp",
                          "Parch", "Fare", "Embarked"),
               output = "Survived",
               train.size = 0.8)
md <- xg_train(d)
p <- xg_predict(md, d$data[train == FALSE])

ArnaudBu/ezXg documentation built on Oct. 30, 2019, 4:59 a.m.