Treelite
|
Frontend for scikit-learn models. More...
#include <treelite/logging.h>
#include <treelite/frontend.h>
#include <treelite/tree.h>
#include <memory>
#include <queue>
#include <algorithm>
#include <numeric>
#include <tuple>
Go to the source code of this file.
Functions | |
template<typename MetaHandlerFunc , typename LeafHandlerFunc > | |
std::unique_ptr< treelite::Model > | LoadSKLearnModel (int n_trees, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity, MetaHandlerFunc meta_handler, LeafHandlerFunc leaf_handler) |
std::unique_ptr< treelite::Model > | LoadSKLearnRandomForestRegressor (int n_estimators, int n_features, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
Load a scikit-learn random forest regressor model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. Note that this function can also be used to load an ensemble of extremely randomized trees (sklearn.ensemble.ExtraTreesRegressor). More... | |
std::unique_ptr< treelite::Model > | LoadSKLearnRandomForestClassifierBinary (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
std::unique_ptr< treelite::Model > | LoadSKLearnRandomForestClassifierMulticlass (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
std::unique_ptr< treelite::Model > | LoadSKLearnRandomForestClassifier (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
Load a scikit-learn random forest classifier model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. Note that this function can also be used to load an ensemble of extremely randomized trees (sklearn.ensemble.ExtraTreesClassifier). More... | |
std::unique_ptr< treelite::Model > | LoadSKLearnGradientBoostingRegressor (int n_estimators, int n_features, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
Load a scikit-learn gradient boosting regressor model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. More... | |
std::unique_ptr< treelite::Model > | LoadSKLearnGradientBoostingClassifierBinary (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
std::unique_ptr< treelite::Model > | LoadSKLearnGradientBoostingClassifierMulticlass (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
std::unique_ptr< treelite::Model > | LoadSKLearnGradientBoostingClassifier (int n_estimators, int n_features, int n_classes, const int64_t *node_count, const int64_t **children_left, const int64_t **children_right, const int64_t **feature, const double **threshold, const double **value, const int64_t **n_node_samples, const double **impurity) |
Load a scikit-learn gradient boosting classifier model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. More... | |
std::unique_ptr< treelite::Model > LoadSKLearnGradientBoostingClassifier | ( | int | n_estimators, |
int | n_features, | ||
int | n_classes, | ||
const int64_t * | node_count, | ||
const int64_t ** | children_left, | ||
const int64_t ** | children_right, | ||
const int64_t ** | feature, | ||
const double ** | threshold, | ||
const double ** | value, | ||
const int64_t ** | n_node_samples, | ||
const double ** | impurity | ||
) |
Load a scikit-learn gradient boosting classifier model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail.
n_estimators | number of trees in the random forest |
n_features | number of features in the training data |
n_classes | number of classes in the target variable |
node_count | node_count[i] stores the number of nodes in the i-th tree |
children_left | children_left[i][k] stores the ID of the left child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
children_right | children_right[i][k] stores the ID of the right child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
feature | feature[i][k] stores the ID of the feature used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
threshold | threshold[i][k] stores the threshold used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
value | value[i][k] stores the leaf output of node k of the i-th tree. This is only defined if node k is a leaf node. |
n_node_samples | n_node_samples[i][k] stores the number of data samples associated with node k of the i-th tree. |
impurity | impurity[i][k] stores the impurity measure (gini, entropy etc) associated with node k of the i-th tree. |
Definition at line 255 of file sklearn.cc.
std::unique_ptr< treelite::Model > LoadSKLearnGradientBoostingRegressor | ( | int | n_estimators, |
int | n_features, | ||
const int64_t * | node_count, | ||
const int64_t ** | children_left, | ||
const int64_t ** | children_right, | ||
const int64_t ** | feature, | ||
const double ** | threshold, | ||
const double ** | value, | ||
const int64_t ** | n_node_samples, | ||
const double ** | impurity | ||
) |
Load a scikit-learn gradient boosting regressor model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail.
n_estimators | number of trees in the random forest |
n_features | number of features in the training data |
node_count | node_count[i] stores the number of nodes in the i-th tree |
children_left | children_left[i][k] stores the ID of the left child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
children_right | children_right[i][k] stores the ID of the right child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
feature | feature[i][k] stores the ID of the feature used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
threshold | threshold[i][k] stores the threshold used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
value | value[i][k] stores the leaf output of node k of the i-th tree. This is only defined if node k is a leaf node. |
n_node_samples | n_node_samples[i][k] stores the number of data samples associated with node k of the i-th tree. |
impurity | impurity[i][k] stores the impurity measure (gini, entropy etc) associated with node k of the i-th tree. |
Definition at line 178 of file sklearn.cc.
std::unique_ptr< treelite::Model > LoadSKLearnRandomForestClassifier | ( | int | n_estimators, |
int | n_features, | ||
int | n_classes, | ||
const int64_t * | node_count, | ||
const int64_t ** | children_left, | ||
const int64_t ** | children_right, | ||
const int64_t ** | feature, | ||
const double ** | threshold, | ||
const double ** | value, | ||
const int64_t ** | n_node_samples, | ||
const double ** | impurity | ||
) |
Load a scikit-learn random forest classifier model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. Note that this function can also be used to load an ensemble of extremely randomized trees (sklearn.ensemble.ExtraTreesClassifier).
n_estimators | number of trees in the random forest |
n_features | number of features in the training data |
n_classes | number of classes in the target variable |
node_count | node_count[i] stores the number of nodes in the i-th tree |
children_left | children_left[i][k] stores the ID of the left child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
children_right | children_right[i][k] stores the ID of the right child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
feature | feature[i][k] stores the ID of the feature used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
threshold | threshold[i][k] stores the threshold used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
value | value[i][k] stores the leaf output of node k of the i-th tree. This is only defined if node k is a leaf node. |
n_node_samples | n_node_samples[i][k] stores the number of data samples associated with node k of the i-th tree. |
impurity | impurity[i][k] stores the impurity measure (gini, entropy etc) associated with node k of the i-th tree. |
Definition at line 162 of file sklearn.cc.
std::unique_ptr< treelite::Model > LoadSKLearnRandomForestRegressor | ( | int | n_estimators, |
int | n_features, | ||
const int64_t * | node_count, | ||
const int64_t ** | children_left, | ||
const int64_t ** | children_right, | ||
const int64_t ** | feature, | ||
const double ** | threshold, | ||
const double ** | value, | ||
const int64_t ** | n_node_samples, | ||
const double ** | impurity | ||
) |
Load a scikit-learn random forest regressor model from a collection of arrays. Refer to https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html to learn the mearning of the arrays in detail. Note that this function can also be used to load an ensemble of extremely randomized trees (sklearn.ensemble.ExtraTreesRegressor).
n_estimators | number of trees in the random forest |
n_features | number of features in the training data |
node_count | node_count[i] stores the number of nodes in the i-th tree |
children_left | children_left[i][k] stores the ID of the left child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
children_right | children_right[i][k] stores the ID of the right child node of node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
feature | feature[i][k] stores the ID of the feature used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
threshold | threshold[i][k] stores the threshold used in the binary tree split at node k of the i-th tree. This is only defined if node k is an internal (non-leaf) node. |
value | value[i][k] stores the leaf output of node k of the i-th tree. This is only defined if node k is a leaf node. |
n_node_samples | n_node_samples[i][k] stores the number of data samples associated with node k of the i-th tree. |
impurity | impurity[i][k] stores the impurity measure (gini, entropy etc) associated with node k of the i-th tree. |
Definition at line 74 of file sklearn.cc.