import (
"fmt"
"go4ml.xyz/base/model"
"go4ml.xyz/dataset/mnist"
"go4ml.xyz/iokit"
"go4ml.xyz/xgb"
"gotest.tools/assert"
"testing"
)
func Test_minstXgb(t *testing.T) {
modelFile := iokit.File(model.Path("mnist_test_xgb.zip"))
report := xgb.Model{
Algorithm: xgb.TreeBoost,
Function: xgb.Softmax,
LearningRate: 0.54,
MaxDepth: 7,
Extra: map[string]interface{}{"tree_method": "hist"},
}.Feed(model.Dataset{
Source: mnist.Data.RandomFlag(model.TestCol, 42, 0.1),
Features: mnist.Features,
}).LuckyTrain(model.Training{
Iterations: 30,
ModelFile: modelFile,
Metrics: model.Classification{Accuracy: 0.96},
Score: model.AccuracyScore,
})
fmt.Println(report.TheBest, report.Score)
fmt.Println(report.History.Round(5))
assert.Assert(t, model.Accuracy(report.Test) >= 0.96)
pred := xgb.LuckyObjectify(modelFile)
lr := model.LuckyEvaluate(mnist.T10k, model.LabelCol, pred, 32, model.Classification{})
fmt.Println(lr.Round(5))
assert.Assert(t, model.Accuracy(lr) >= 0.96)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Golang API for XGBoost
License
go4ml/xgb
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Golang API for XGBoost
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published