treelite
Functions
C API: Getters and setters for tree fields

Functions

int TreeliteGetHeaderField (TreeliteModelHandle model, char const *name, TreelitePyBufferFrame *out_frame)
 Get a field in the header. More...
 
int TreeliteGetTreeField (TreeliteModelHandle model, uint64_t tree_id, char const *name, TreelitePyBufferFrame *out_frame)
 Get a field in a tree. More...
 
int TreeliteSetHeaderField (TreeliteModelHandle model, char const *name, TreelitePyBufferFrame frame)
 Set a field in the header. More...
 
int TreeliteSetTreeField (TreeliteModelHandle model, uint64_t tree_id, char const *name, TreelitePyBufferFrame frame)
 Set a field in a tree. More...
 

Detailed Description

The getter and setter methods are useful for modifying a tree model in-place. This interface should be used by an expert user, as the interface performs no validation for the setter.

Function Documentation

◆ TreeliteGetHeaderField()

int TreeliteGetHeaderField ( TreeliteModelHandle  model,
char const *  name,
TreelitePyBufferFrame out_frame 
)

Get a field in the header.

This function returns the requested field using the Python buffer protocol (PEP 3118).

Parameters
modelTreelite Model object
nameName of the field
out_frameBuffer frame representing the requested field
Returns
0 for success; -1 for failure

◆ TreeliteGetTreeField()

int TreeliteGetTreeField ( TreeliteModelHandle  model,
uint64_t  tree_id,
char const *  name,
TreelitePyBufferFrame out_frame 
)

Get a field in a tree.

This function returns the requested field using the Python buffer protocol (PEP 3118).

Parameters
modelTreelite Model object
tree_idID of the tree
nameName of the field
out_frameBuffer frame representing the requested field
Returns
0 for success; -1 for failure

◆ TreeliteSetHeaderField()

int TreeliteSetHeaderField ( TreeliteModelHandle  model,
char const *  name,
TreelitePyBufferFrame  frame 
)

Set a field in the header.

This function accepts the field's new value using the Python buffer protocol (PEP 3118).

Parameters
modelTreelite Model object
nameName of the field
frameBuffer frame representing the new value for the field
Returns
0 for success; -1 for failure

◆ TreeliteSetTreeField()

int TreeliteSetTreeField ( TreeliteModelHandle  model,
uint64_t  tree_id,
char const *  name,
TreelitePyBufferFrame  frame 
)

Set a field in a tree.

This function accepts the field's new value using the Python buffer protocol (PEP 3118).

Parameters
modelTreelite Model object
tree_idID of the tree
nameName of the field
frameBuffer frame representing the new value for the field
Returns
0 for success; -1 for failure