Classes | |
struct | forest |
struct | treelite_params_t |
Typedefs | |
template<typename real_t > | |
using | forest_t = forest< real_t > * |
using | forest32_t = forest< float > * |
using | forest64_t = forest< double > * |
using | forest_variant = std::variant< forest_t< float >, forest_t< double > > |
Enumerations | |
enum | algo_t { ALGO_AUTO , NAIVE , TREE_REORG , BATCH_TREE_REORG } |
enum | storage_type_t { AUTO , DENSE , SPARSE , SPARSE8 } |
enum | precision_t { PRECISION_NATIVE , PRECISION_FLOAT32 , PRECISION_FLOAT64 } |
Functions | |
void | from_treelite (const raft::handle_t &handle, forest_variant *pforest, TreeliteModelHandle model, const treelite_params_t *tl_params) |
template<typename real_t > | |
void | free (const raft::handle_t &h, forest_t< real_t > f) |
template<typename real_t > | |
void | predict (const raft::handle_t &h, forest_t< real_t > f, real_t *preds, const real_t *data, size_t num_rows, bool predict_proba=false) |
Variables | |
constexpr int | MAX_N_ITEMS = 4 |
using ML::fil::forest32_t = typedef forest<float>* |
forest32_t and forest64_t are definitions required in Cython
using ML::fil::forest64_t = typedef forest<double>* |
using ML::fil::forest_t = typedef forest<real_t>* |
forest_t is the predictor handle
using ML::fil::forest_variant = typedef std::variant<forest_t<float>, forest_t<double> > |
forest_variant is used to get a forest represented with either float or double.
enum ML::fil::algo_t |
enum ML::fil::precision_t |
precision_t defines the precision of the FIL model imported from a treelite model
storage_type_t defines whether to import the forests as dense or sparse
void ML::fil::free | ( | const raft::handle_t & | h, |
forest_t< real_t > | f | ||
) |
free deletes forest and all resources held by it; after this, forest is no longer usable
h | cuML handle used by this function |
f | the forest to free; not usable after the call to this function |
void ML::fil::from_treelite | ( | const raft::handle_t & | handle, |
forest_variant * | pforest, | ||
TreeliteModelHandle | model, | ||
const treelite_params_t * | tl_params | ||
) |
from_treelite uses a treelite model to initialize the forest
handle | cuML handle used by this function |
pforest | pointer to where to store the newly created forest |
model | treelite model used to initialize the forest |
tl_params | additional parameters for the forest |
void ML::fil::predict | ( | const raft::handle_t & | h, |
forest_t< real_t > | f, | ||
real_t * | preds, | ||
const real_t * | data, | ||
size_t | num_rows, | ||
bool | predict_proba = false |
||
) |
predict predicts on data (with n rows) using forest and writes results into preds; the number of columns is stored in forest, and both preds and data point to GPU memory
h | cuML handle used by this function |
f | forest used for predictions |
preds | array in GPU memory to store predictions into size = predict_proba ? (2*num_rows) : num_rows |
data | array of size n * cols (cols is the number of columns for the forest f) from which to predict |
num_rows | number of data rows |
predict_proba | for classifier models, this forces to output both class probabilities instead of binary class prediction. format matches scikit-learn API |
|
constexpr |
MAX_N_ITEMS determines the maximum allowed value for tl_params::n_items