converters.sklearn._tree_ensemble

Module Contents

Functions

_get_value(scikit_value,mode=”regressor”,scaling=1.0,n_classes=2,tree_index=0) Get the right value from the scikit-tree
_recurse(coreml_tree,scikit_tree,tree_id,node_id,scaling=1.0,mode=”regressor”,n_classes=2,tree_index=0) Traverse through the tree and append to the tree spec.
get_input_dimension(model)
convert_tree_ensemble(model,input_features,output_features=tuple,mode=”regressor”,base_prediction=None,class_labels=None,post_evaluation_transform=None) Convert a generic tree regressor model to the protobuf spec.
_get_value(scikit_value, mode="regressor", scaling=1.0, n_classes=2, tree_index=0)

Get the right value from the scikit-tree

_recurse(coreml_tree, scikit_tree, tree_id, node_id, scaling=1.0, mode="regressor", n_classes=2, tree_index=0)

Traverse through the tree and append to the tree spec.

get_input_dimension(model)
convert_tree_ensemble(model, input_features, output_features=tuple, mode="regressor", base_prediction=None, class_labels=None, post_evaluation_transform=None)

Convert a generic tree regressor model to the protobuf spec.

This currently supports:
  • Decision tree regression
  • Gradient boosted tree regression
  • Random forest regression
  • Decision tree classifier.
  • Gradient boosted tree classifier.
  • Random forest classifier.

Parameters model: [DecisionTreeRegressor | GradientBoostingRegression | RandomForestRegressor]

A scikit learn tree model.
feature_names : list of strings, optional (default=None)
Names of each of the features.
target: str
Name of the output column.
base_prediction: double
Base prediction value.
mode: str in [‘regressor’, ‘classifier’]
Mode of the tree model.
class_labels: list[int]
List of classes
post_evaluation_transform: list[int]
Post evaluation transform
model_spec: An object of type Model_pb.
Protobuf representation of the model