Giter VIP home page Giter VIP logo

catboost-go's Introduction

CatBoost Wrapper for Go

Simple wrapper of CatBoost C library for prediction

Installation

CatBoost library is assumed to be installed and all its includes and library files are assumed to be found in corresponding paths. One way to do it is using environment variables:

git clone https://github.com/catboost/catboost.git
cd catboost/catboost/libs/model_interface && ../../../ya make -r .
export CATBOOST_DIR=$(pwd)
export C_INCLUDE_PATH=$CATBOOST_DIR:$C_INCLUDE_PATH
export LIBRARY_PATH=$CATBOOST_DIR:$LIBRARY_PATH
export LD_LIBRARY_PATH=$CATBOOST_DIR:$LD_LIBRARY_PATH

The other way is to put compiled library files and include files to default search diretories (/usr/local/lib, /usr/local/include). If everything above is properly configured then a simple go get command will do the trick:

go get -u github.com/ma3axaka/catboost-go

catboost-go's People

Contributors

bourbaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

catboost-go's Issues

Issue with Running catboost-go on Windows

Description:
I am encountering an issue when trying to run catboost-go on a Windows platform. It appears that the Model struct and the LoadFullModelFromFile method are undefined in the catboost-go library.

Case Scenario:

I have developed a machine learning model using CatBoost in Python.
I am trying to use this model with the catboost-go library on a Windows machine.
Error:
When attempting to execute the code, I get the following error:

# github.com/ma3axaka/catboost-go
classifier.go:7:9: undefined: Model
classifier.go:16:16: undefined: LoadFullModelFromFile

Operating System:
Windows

Steps to Reproduce:

Import the catboost-go library.
Load a CatBoost model using the LoadFullModelFromFile method.
Attempt to execute predictions.
Expected Behavior:
I expected to be able to load the model and make predictions using the catboost-go library.

Actual Behavior:
I encountered the "undefined: Model" and "undefined: LoadFullModelFromFile" errors.

Additional Information:

I am running my code on a Windows machine.
I have checked the version of the catboost-go library, and it is up to date.
Example Code:


package main

import (
    "fmt"
    "github.com/ma3axaka/catboost-go"
)

func main() {
    model, _ := catboost.LoadBinaryClassifierFromFile("model.cbm")
    numbers := make([][]float32, 0)
    categories := [][]string{{"HOLD", "BUY", "HOLD"}}
    prob, _ := model.PredictProba(numbers, 0, categories, 3)
    fmt.Println(prob)
}

Note:
I would appreciate any guidance or assistance on how to resolve this issue and successfully run catboost-go on Windows.

Thnx!

panic: runtime error: cgo argument has Go pointer to Go pointer

My code

  1 package main
  2
  3 import "fmt"
  4 import "github.com/ma3axaka/catboost-go"
  5 func main() {
  6     model, _:= catboost.LoadBinaryClassifierFromFile("catboost_demo.cbm")
  7      fmt.Println(err)
  8     numbers := [][]float32{{2.0, 3.0, 5.0, 7.0}}
  9     categories := [][]string{{"a", "b"}}
 10    prob, _ := model.PredictProba(numbers,4, categories,2)
 11    fmt.Println(prob)
 12 }

Here is the exception:

panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running]:
github.com/ma3axaka/catboost-go.(*Model).CalcModelPrediction.func2(0xc000010028, 0x1, 0xc000010038, 0x1, 0x1, 0x4, 0xc000010040, 0x1, 0x1, 0x2, ...)
	/home/phuongdv/gows/src/github.com/ma3axaka/catboost-go/model.go:99 +0xaf
github.com/ma3axaka/catboost-go.(*Model).CalcModelPrediction(0xc000010028, 0xc00009ff70, 0x1, 0x1, 0x4, 0xc00009ff58, 0x1, 0x1, 0x2, 0x0, ...)
	/home/phuongdv/gows/src/github.com/ma3axaka/catboost-go/model.go:99 +0x285
github.com/ma3axaka/catboost-go.(*BinaryClassifer).PredictProba(0xc00009ff30, 0xc00009ff70, 0x1, 0x1, 0x4, 0xc00009ff58, 0x1, 0x1, 0x2, 0x4a78c0, ...)
	/home/phuongdv/gows/src/github.com/ma3axaka/catboost-go/classifier.go:25 +0xab
main.main()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.