From bd9bd5005c2d34709d13ece71ff1a101f5673dc8 Mon Sep 17 00:00:00 2001 From: boccaff Date: Thu, 20 Feb 2025 11:03:09 +0000 Subject: [PATCH] fix: sklearn 1.3.2 ci fail The attribute classes was introduced later on 1.4. Changed the test to not rely on it. Signed-off-by: boccaff --- skl2onnx/operator_converters/target_encoder.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/skl2onnx/operator_converters/target_encoder.py b/skl2onnx/operator_converters/target_encoder.py index ca9e06b68..9d71eb471 100644 --- a/skl2onnx/operator_converters/target_encoder.py +++ b/skl2onnx/operator_converters/target_encoder.py @@ -20,10 +20,12 @@ def convert_sklearn_target_encoder( input_idx = 0 dimension_idx = 0 - if (op.target_type_ == "multiclass") or ( - isinstance(op.classes_.dtype, np.int64) and (len(op.classes_) > 2) - ): - raise NotImplementedError("multiclass TargetEncoder is not supported") + if op.target_type_ not in ("binary", "continuous"): + raise NotImplementedError( + "Current implementation of the converter only support TargetEncoder for" + " binary classification or 1d regression (sklearn target types binary" + " or continuous). See scikit-learn type_of_target documentation for details." + ) for categories, encodings in zip(op.categories_, op.encodings_): if len(categories) == 0: continue