treelite
Public Member Functions | List of all members
BranchAnnotator Class Reference

branch annotator class More...

#include <annotator.h>

Public Member Functions

void Annotate (const Model &model, const DMatrix *dmat, int nthread, int verbose)
 annotate branches in a given model using frequency patterns in the training data. The annotation can be accessed through Get() method. More...
 
void Load (dmlc::Stream *fi)
 load branch annotation from a JSON file More...
 
void Save (dmlc::Stream *fo) const
 save branch annotation to a JSON file More...
 
std::vector< std::vector< size_t > > Get () const
 fetch branch annotation. Usage example: More...
 

Detailed Description

branch annotator class

Definition at line 17 of file annotator.h.

Member Function Documentation

void Annotate ( const Model model,
const DMatrix dmat,
int  nthread,
int  verbose 
)

annotate branches in a given model using frequency patterns in the training data. The annotation can be accessed through Get() method.

Parameters
modeltree ensemble model
dmattraining data matrix
nthreadnumber of threads to use
verbosewhether to produce extra messages

Definition at line 95 of file annotator.cc.

std::vector<std::vector<size_t> > Get ( ) const
inline

fetch branch annotation. Usage example:

Annotator annotator
annotator.Load(fi); // load from a stream
std::vector<std::vector<size_t>> annot = annotator.Get();
// access the frequency count for a specific node in a tree
LOG(INFO) << "Tree " << tree_id << ", Node " << node_id << ": "
<< annot[tree_id][node_id];
Returns
branch annotation in 2D vector

Definition at line 52 of file annotator.h.

void Load ( dmlc::Stream *  fi)

load branch annotation from a JSON file

Parameters
fiinput stream

Definition at line 138 of file annotator.cc.

void Save ( dmlc::Stream *  fo) const

save branch annotation to a JSON file

Parameters
fooutput stream

Definition at line 145 of file annotator.cc.


The documentation for this class was generated from the following files: