pymoose.predictors.tree_ensemble module
pymoose.predictors.tree_ensemble module#
- class pymoose.predictors.tree_ensemble.DecisionTreeRegressor(weights, children, split_conditions, split_indices)[source]#
- class pymoose.predictors.tree_ensemble.TreeEnsemble(trees, n_features, base_score, learning_rate)[source]#
- class pymoose.predictors.tree_ensemble.TreeEnsembleClassifier(trees, n_features, n_classes, base_score, learning_rate, transform_output, tree_class_map)[source]#
Bases:
pymoose.predictors.tree_ensemble.TreeEnsemble
Tree ensemble classification Predictor for GBTs and Random Forests.
This class can be used for binary, multiclass, or multilabel classification. Support for multiclass classification uses the one-vs-rest method.
- Parameters
trees – Nested collection of :class:`~DecisionTreeRegressor`s.
n_features – Number of features expected for input data.
n_classes – Number of output classes.
base_score – The base score for the underlying tree ensemble model, similar to a bias/intercept term.
learning_rate – Learning rate parameter used to re-scale leaf weights in the model trees.
transform_output – Boolean determining whether a softmax should be applied to derive probabilities from the tree ensemble output.
tree_class_map – Dictionary mapping
trees
indices to class indices. Keeps track of which trees intrees
correspond to each class in the one-vs-rest formulation of multiclass classification.
- classmethod from_onnx(model_proto)[source]#
Construct a TreeEnsembleClassifier from a parsed ONNX model.
- Parameters
model_proto – An ONNX ModelProto containing a TreeEnsembleClassifier node.
- Returns
A TreeEnsembleClassifier built from the parameters and configuration of the given ONNX model.
- Raises
ValueError if ONNX graph is missing expected nodes. –
- class pymoose.predictors.tree_ensemble.TreeEnsembleRegressor(trees, n_features, base_score, learning_rate)[source]#
Bases:
pymoose.predictors.tree_ensemble.TreeEnsemble
Tree ensemble regression Predictor, accommodating both GBTs and Random Forests.
- Parameters
trees – Nested collection of :class:`~DecisionTreeRegressor`s.
n_features – Number of features expected for input data.
base_score – The base score for the underlying tree ensemble model, similar to a bias/intercept term.
learning_rate – Learning rate parameter used to re-scale leaf weights in the model trees.
- classmethod from_onnx(model_proto)[source]#
Construct a TreeEnsembleRegressor from a parsed ONNX model.
- Parameters
model_proto – An ONNX ModelProto containing a TreeEnsembleRegressor node.
- Returns
A TreeEnsembleRegressor built from the parameters and configuration of the given ONNX model.
- Raises
ValueError if ONNX graph is missing expected nodes. –