-
Notifications
You must be signed in to change notification settings - Fork 110
Detailed Interface
All data should be transformed to DMatrix
DMatrix
support to be built directly from
-
libSVM
txt format file -
XGBoost
buffer file - Julia
Array{Real, 2}
- Julia
SparseMatrixCSC{K, V}
whereK<:Real
andV<:Int
Booster
is the model struct. To get Booster
object, you can load from saved model file or use method
To fit a model, use the function bst = xgboost(dtrain, nrounds, param=param, watchlist=watchlist, obj=obj, feval=feval)
where
-
dtrain
training data inDMatrix
, required -
nrounds
training epoch inInteger
, required -
param
parameter pairs for XGBoost inDict
orArray{(ASCIIString, Any), 1}
, optional -
watchlist
data need to be evaulated inArray{(DMatrix, ASCIIString), 1}
, optional -
obj
customized objective function to be boosted, optional -
feval
customized evaluation function, optional
Check demo for all usage
To do prediction, use the function preds = predict(bst, dmat, output_margin=output_margin, ntree_limit=ntree_limit)
where
-
bst
fitted modelBooster
object, required -
dmat
data to be predicted inDMatrix
, required -
output_margin
whether to change the output to margin probability,Bool
, optional -
ntree_limit
number of trees used in prediction,Integer
, optional
To save Booster
object into binary file, use the function save(bst, fname)
, where
-
bst
fitted modelBooster
object, required -
fname
output file name inASCIIString
, required
To save DMatrix
object into binary file, use the function save(dmat, fname)
, where
-
dmat
data inDMatrix
object, required -
fname
output file name inASCIIString
, required
To dump Booster
model into readable txt file, use the function dump_model(bst, fname, fmap=fmap)
where
-
bst
fitted modelBooster
object, required -
fname
output file name inASCIIString
, required -
fmap
file path to feature map file, optional
To slice DMatrix
, use the function dnew = slice(dmat, idxset)
where
-
dmat
data inDMatrix
object, required -
idxset
id of index to be selected inArray{T, 1}
, required
To get label
, weight
, base_margin
and group
from DMatrix
, use function get_info(dmat, field)
where
-
dmat
data inDMatrix
object, required -
field
ASCIIString
oflabel
,weight
,base_margin
andgroup
To set label
, weight
, base_margin
and group
to DMatrix
, use function set_info(dmat, field, array)
where
-
dmat
data inDMatrix
object, required -
field
ASCIIString
oflabel
,weight
,base_margin
andgroup
-
array
meta info inArray{T, 1}
to be set into dmat
To do cross validation, use the function nfold_cv(param, dtrain, num_boost_round, nfold, metrics=metrics, obj=obj, feval=feval, fpreproc=fpreproc, show_stdv=show_stdv, seed=seed)
where
-
param
parameter pairs for XGBoost inDict
orArray{(ASCIIString, Any), 1}
, required -
dtrain
training data inDMatrix
, required -
num_boost_round
training epoch inInteger
, required -
nfold
fold used for cv inInteger
, required -
metrics
metrics used in cv inArray{ASCIIString, 1}
, optional -
obj
customized objective function to be boosted, optional -
feval
customized evaluation function, optional -
fpreproc
customized preprocessing function, optional -
show_stdv
whether show std value for result, optional -
seed
random seed inInteger