treelite
|
Classes | |
struct | Configuration |
Configuration class. More... | |
Enumerations | |
enum class | PredictKind : std::int8_t { kPredictDefault = 0 , kPredictRaw = 1 , kPredictLeafID = 2 , kPredictPerTree = 3 } |
Prediction type. More... | |
Functions | |
template<typename InputT > | |
void | Predict (Model const &model, InputT const *input, std::uint64_t num_row, InputT *output, Configuration const &config) |
Predict with dense data. More... | |
template<typename InputT > | |
void | PredictSparse (Model const &model, InputT const *data, std::uint64_t const *col_ind, std::uint64_t const *row_ptr, std::uint64_t num_row, InputT *output, Configuration const &config) |
Predict with sparse data with CSR (compressed sparse row) layout. More... | |
std::vector< std::uint64_t > | GetOutputShape (Model const &model, std::uint64_t num_row, Configuration const &config) |
Given a data matrix, query the necessary shape of array to hold predictions for all data points. More... | |
template void | Predict< float > (Model const &, float const *, std::uint64_t, float *, Configuration const &) |
template void | Predict< double > (Model const &, double const *, std::uint64_t, double *, Configuration const &) |
template void | PredictSparse< float > (Model const &, float const *, std::uint64_t const *, std::uint64_t const *, std::uint64_t, float *, Configuration const &) |
template void | PredictSparse< double > (Model const &, double const *, std::uint64_t const *, std::uint64_t const *, std::uint64_t, double *, Configuration const &) |
|
strong |
Prediction type.
std::vector<std::uint64_t> treelite::gtil::GetOutputShape | ( | Model const & | model, |
std::uint64_t | num_row, | ||
Configuration const & | config | ||
) |
Given a data matrix, query the necessary shape of array to hold predictions for all data points.
model | Treelite Model object |
num_row | Number of rows in the input |
config | Configuration of GTIL predictor. Set this by calling TreeliteGTILParseConfig. |
void treelite::gtil::Predict | ( | Model const & | model, |
InputT const * | input, | ||
std::uint64_t | num_row, | ||
InputT * | output, | ||
Configuration const & | config | ||
) |
Predict with dense data.
model | Treelite Model object |
input | The 2D data array, laid out in row-major layout |
num_row | Number of rows in the data matrix. |
output | Pointer to buffer to store the output. Call GetOutputShape to get the amount of buffer you should allocate for this parameter. |
config | Configuration of GTIL predictor |
template void treelite::gtil::Predict< double > | ( | Model const & | , |
double const * | , | ||
std::uint64_t | , | ||
double * | , | ||
Configuration const & | |||
) |
template void treelite::gtil::Predict< float > | ( | Model const & | , |
float const * | , | ||
std::uint64_t | , | ||
float * | , | ||
Configuration const & | |||
) |
void treelite::gtil::PredictSparse | ( | Model const & | model, |
InputT const * | data, | ||
std::uint64_t const * | col_ind, | ||
std::uint64_t const * | row_ptr, | ||
std::uint64_t | num_row, | ||
InputT * | output, | ||
Configuration const & | config | ||
) |
Predict with sparse data with CSR (compressed sparse row) layout.
In the CSR layout, data[row_ptr[i]:row_ptr[i+1]] store the nonzero entries of row i, and col_ind[row_ptr[i]:row_ptr[i+1]] stores the corresponding column indices.
model | Treelite Model object |
data | Nonzero elements in the data matrix |
col_ind | Feature indices. col_ind[i] indicates the feature index associated with data[i]. |
row_ptr | Pointer to row headers. Length is [num_row] + 1. |
num_row | Number of rows in the data matrix. |
output | Pointer to buffer to store the output. Call GetOutputShape to get the amount of buffer you should allocate for this parameter. |
config | Configuration of GTIL predictor |
template void treelite::gtil::PredictSparse< double > | ( | Model const & | , |
double const * | , | ||
std::uint64_t const * | , | ||
std::uint64_t const * | , | ||
std::uint64_t | , | ||
double * | , | ||
Configuration const & | |||
) |
template void treelite::gtil::PredictSparse< float > | ( | Model const & | , |
float const * | , | ||
std::uint64_t const * | , | ||
std::uint64_t const * | , | ||
std::uint64_t | , | ||
float * | , | ||
Configuration const & | |||
) |