yobx.sklearn.imblearn.easy_ensemble#
- yobx.sklearn.imblearn.easy_ensemble.imblearn_pipeline(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: Pipeline, X: str, name: str = 'imblearn_pipeline') str | Tuple[str, ...][source]#
Converts an
imblearn.pipeline.Pipelineinto ONNX.At inference time,
imblearn.pipeline.Pipelineskips all resampling steps (those exposing afit_resamplemethod) and applies only the transformers and the final estimator, identical tosklearn.pipeline.Pipelineover the filtered step list.- Parameters:
g – the graph builder to add nodes to
sts – shapes and types defined by scikit-learn
outputs – desired output tensor names for the pipeline result
estimator – a fitted
imblearn.pipeline.PipelineX – name of the input tensor
name – prefix used for names of nodes added by this converter
- Returns:
name of the output tensor, or a tuple of output tensor names
- yobx.sklearn.imblearn.easy_ensemble.sklearn_easy_ensemble_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: EasyEnsembleClassifier, X: str, name: str = 'easy_ensemble_classifier') str | Tuple[str, str][source]#
Converts an
imblearn.ensemble.EasyEnsembleClassifierinto ONNX.EasyEnsembleClassifieris an ensemble of AdaBoost learners each trained on a different balanced bootstrap sample (obtained by random under-sampling). At inference time, the resampling step is inactive; each sub-estimator is therefore effectively a plain classifier.Probabilities from all sub-estimators are averaged (soft aggregation) and the winning class is determined by an argmax over the averaged probability vector. Each sub-estimator is applied to the feature subset recorded in
estimators_features_(all features by default).The sub-estimators stored in
estimators_areimblearn.pipeline.Pipelineinstances wrapping a resampler and a classifier. This converter callsimblearn_pipeline()for each of them, which transparently drops the resampler at inference time.Graph structure (two sub-estimators as an example):
X ──Gather(cols_0)──[sub-pipeline 0]──► (_, proba_0) (N, C) X ──Gather(cols_1)──[sub-pipeline 1]──► (_, proba_1) (N, C) Unsqueeze(axis=0) ──► proba_0 (1, N, C), proba_1 (1, N, C) Concat(axis=0) ──► stacked (E, N, C) ReduceMean(axis=0) ──► avg_proba (N, C) ArgMax(axis=1) ──Cast──Gather(classes_) ──► label- Parameters:
g – the graph builder to add nodes to
sts – shapes and types defined by scikit-learn
outputs – desired output tensor names; two entries for
(label, probabilities), one entry for label onlyestimator – a fitted
EasyEnsembleClassifierX – name of the input tensor
name – prefix used for names of nodes added by this converter
- Returns:
label tensor name, or tuple
(label, probabilities)