xgboost

package module
v0.0.0-...-9fef4a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2018 License: MIT Imports: 4 Imported by: 0

README

WORK IN PROGRESS... USE AT OWN RISK :-)

Build Status GoDoc

go-xgboost

Go bindings for XGBoost

import "github.com/Applifier/go-xgboost"

Usage

This library is meant for running predictions against a pre-trained XGBoost model. Limited training related functionality is implemented under core but training the model in python or using the xgboost cli is encouraged.


// Create predictor for a model and define the number of workers (and other settings)
predictor, _ := xgboost.NewPredictor(modelPath, runtime.NumCPU(), 0, 0, -1)

// Make prediction for one row
res, _ := predictor.Predict(xgboost.FloatSliceVector([]float32{1, 2, 3}))
fmt.Printf("Results: %+v\n", res)
// output: Results: [1.08002]

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FloatSliceVector

type FloatSliceVector []float32

FloatSliceVector float32 slice backed Matrix implementation

func (FloatSliceVector) Data

func (fsm FloatSliceVector) Data() (data []float32, rowCount, columnCount int)

Data returns float32 slice as (1, len(data)) matrix

type Matrix

type Matrix interface {
	Data() (data []float32, rowCount, columnCount int)
}

Matrix interface for 2D matrix

type Predictor

type Predictor interface {
	Predict(input Matrix) ([]float32, error)
	Close(ctx context.Context) error
}

Predictor interface for xgboost predictors

func NewPredictor

func NewPredictor(xboostSavedModelPath string, workerCount int, optionMask int, nTreeLimit uint, missingValue float32) (Predictor, error)

NewPredictor returns a new predictor based on given model path, worker count, option mask, ntree_limit and missing value indicator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL