yobx.sklearn.ensemble.random_forest#
- yobx.sklearn.ensemble.random_forest.sklearn_extra_trees_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: ExtraTreesClassifier, X: str, name: str = 'extra_trees_classifier') Tuple[str, str][source]#
Converts a
sklearn.ensemble.ExtraTreesClassifierinto ONNX.Extra Trees share the same internal tree structure as Random Forests (a list of fitted base estimators with a
tree_attribute). This converter therefore delegates entirely to the same attribute-extraction helpers used bysklearn_random_forest_classifier().When
ai.onnx.mlopset 5 (or later) is active in the graph builder the unifiedTreeEnsembleoperator is used; otherwise the legacyTreeEnsembleClassifieroperator is emitted.- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
ExtraTreesClassifieroutputs – desired output names (label, probabilities)
X – input tensor name
name – prefix for node names added to the graph
- Returns:
tuple
(label_result_name, proba_result_name)
- yobx.sklearn.ensemble.random_forest.sklearn_extra_trees_regressor(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: ExtraTreesRegressor, X: str, name: str = 'extra_trees_regressor') str[source]#
Converts a
sklearn.ensemble.ExtraTreesRegressorinto ONNX.Extra Trees share the same internal tree structure as Random Forests. This converter delegates to the same attribute-extraction helpers used by
sklearn_random_forest_regressor().When
ai.onnx.mlopset 5 (or later) is active in the graph builder the unifiedTreeEnsembleoperator is used (leaf weights pre-divided byn_estimatorsso thatSUMaggregation yields the average); otherwise the legacyTreeEnsembleRegressoroperator is emitted withaggregate_function="AVERAGE".- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
ExtraTreesRegressoroutputs – desired output names (predictions)
X – input tensor name
name – prefix for node names added to the graph
- Returns:
output tensor name
- yobx.sklearn.ensemble.random_forest.sklearn_random_forest_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: RandomForestClassifier, X: str, name: str = 'random_forest_classifier') Tuple[str, str][source]#
Converts a
sklearn.ensemble.RandomForestClassifierinto ONNX.When
ai.onnx.mlopset 5 (or later) is active in the graph builder the unifiedTreeEnsembleoperator is used; otherwise the legacyTreeEnsembleClassifieroperator is emitted.The forest is encoded as a single multi-tree ONNX node where each estimator’s leaf weights are divided by
n_estimatorsso that theSUMaggregate (orNONEpost-transform in the legacy path) yields the averaged class-probability vector used bypredict_proba().- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
RandomForestClassifieroutputs – desired output names (label, probabilities)
X – input tensor name
name – prefix for node names added to the graph
- Returns:
tuple
(label_result_name, proba_result_name)
- yobx.sklearn.ensemble.random_forest.sklearn_random_forest_regressor(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: RandomForestRegressor, X: str, name: str = 'random_forest_regressor') str[source]#
Converts a
sklearn.ensemble.RandomForestRegressorinto ONNX.When
ai.onnx.mlopset 5 (or later) is active in the graph builder the unifiedTreeEnsembleoperator is used (leaf weights pre-divided byn_estimatorsso thatSUMaggregation yields the average); otherwise the legacyTreeEnsembleRegressoroperator is emitted withaggregate_function="AVERAGE".- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
RandomForestRegressoroutputs – desired output names (predictions)
X – input tensor name
name – prefix for node names added to the graph
- Returns:
output tensor name