No description
Find a file
2021-04-26 12:40:55 +08:00
docs Release 0.1.3 2021-04-26 12:40:55 +08:00
example add single row prediction 2021-04-22 15:59:26 +08:00
src added XGDMatrixInfoKey 2021-04-26 12:37:51 +08:00
tests added save/load model 2021-04-22 12:29:25 +08:00
.gitignore added save/load model 2021-04-22 12:29:25 +08:00
.release-it.json fix relase-it hooks 2021-04-22 11:48:03 +08:00
LICENSE fix license 2021-04-22 12:48:14 +08:00
README.md update readme 2021-04-22 17:40:04 +08:00
xgboost.nimble Release 0.1.3 2021-04-26 12:40:55 +08:00

xgboost.nim

Nim binding of xgboost 1.4.x

Installation

This binding depends on the shared library of xgboost. You should be able to build it with the following commands.

nimble clone_xgboost
nimble build_xgboost

The resulting shared library should be located in ./xgboost/lib/. If you encouter issues during build, consult the installation guide of xgboost.

Usage

import xgboost

proc main() =
  # global config
  xgbSetGlobalConfig(%*{
    "verbosity": 3
  })

  # https://github.com/dmlc/xgboost/tree/master/demo/data
  let dtrain = newXGDMatrix("agaricus.txt.train")
  let dtest = newXGDMatrix("agaricus.txt.test")
  
  # train
  let booster = train({
    "max_depth": "2", 
    "eta": "1", 
    "objective": "binary:logistic" 
  }, dtrain)

  # predict
  let res = booster.predict(dtest)
  echo res

  # save model
  booster.saveModel("agaricus.txt.model")

when isMainModule:
  main()

API

see here