-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.go
60 lines (46 loc) · 1.57 KB
/
metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"fmt"
"log"
"path"
"path/filepath"
"runtime"
cb "github.com/mirecl/catboost-cgo/catboost"
)
func main() {
_, fileName, _, _ := runtime.Caller(0)
modelPath := path.Join(filepath.Dir(fileName), "metadata.cbm")
model, err := cb.LoadFullModelFromFile(modelPath)
if err != nil {
log.Fatalln(err)
}
catboostVersinInfo := model.GetModelInfoValue(cb.MetaVersionInfo)
fmt.Printf("CATBOOST_VERSION_INFO:\n%s\n", catboostVersinInfo)
trainFinishTime := model.GetModelInfoValue(cb.MetaTrainFinishTime)
fmt.Printf("TRAIN_FINISH_TIME:\n%s\n\n", trainFinishTime)
outputOptions := model.GetModelInfoValue(cb.MetaOutputOptions)
fmt.Printf("OUTPUT_OPTIONS:\n%s\n\n", outputOptions)
exampleValue := model.GetModelInfoValue("example_key")
fmt.Printf("EXAMPLE_KEY:\n%s\n\n", exampleValue)
modelGuid := model.GetModelInfoValue(cb.MetaModelGUID)
fmt.Printf("MODEL_GUID:\n%s\n\n", modelGuid)
params := model.GetModelInfoValue(cb.MetaParams)
fmt.Printf("PARAMS:\n%s\n\n", params)
fmt.Printf("Float features count: %d\n", model.GetFloatFeaturesCount())
fmt.Printf("Cat features count: %d\n", model.GetCatFeaturesCount())
features, err := model.GetModelUsedFeaturesNames()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("Used Features names: %v\n", features)
catIndices, err := model.GetCatFeatureIndices()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("Used Cat Features Indices: %v\n", catIndices)
floatIndices, err := model.GetFloatFeatureIndices()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("Used Float Features Indices: %v\n", floatIndices)
}