xgboost.nim
Nim wrapper of libxgboost
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install xgboost.nim
choosenim install xgboost.nim
git clone https://github.com/jackhftang/xgboost.nim
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| xgboost.nim | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/jackhftang/xgboost.nim |
|---|---|
| Homepage | https://github.com/jackhftang/xgboost.nim |
| Registry Source | nimble_official |
README
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