yobx.sklearn.imblearn.balanced_random_forest#
- yobx.sklearn.imblearn.balanced_random_forest.sklearn_balanced_random_forest_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: BalancedRandomForestClassifier, X: str, name: str = 'balanced_random_forest_classifier') str | Tuple[str, str][source]#
Converts an
imblearn.ensemble.BalancedRandomForestClassifierinto ONNX.BalancedRandomForestClassifieris a subclass ofRandomForestClassifierthat trains each tree on a balanced bootstrap sample (obtained by random under-sampling). At inference time the resampling step is inactive; the resulting forest has exactly the same structure as a regularRandomForestClassifierand is therefore converted using the same helpers.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
outputs – desired output names (label, probabilities)
estimator – a fitted
BalancedRandomForestClassifierX – input tensor name
name – prefix for node names added to the graph
- Returns:
label tensor name, or tuple
(label_result_name, proba_result_name)