Skip to content

Commit

Permalink
fix disc
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Dupre <[email protected]>
  • Loading branch information
xadupre committed May 22, 2024
1 parent 293391d commit 03db70c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion skl2onnx/operator_converters/linear_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,24 @@ def convert_sklearn_linear_classifier(
classifier_attrs["post_transform"] = "NONE"
elif isinstance(op, LogisticRegression):
classifier_attrs["post_transform"] = (
"LOGISTIC" if (use_ovr or multi_class == 0) else "SOFTMAX"
"LOGISTIC"
if (use_ovr or (multi_class == 0 and op.intercept_.size <= 1))
else "SOFTMAX"
)
else:
classifier_attrs["post_transform"] = (
"LOGISTIC" if multi_class > 2 else "SOFTMAX"
)

print(
"***",
multi_class,
classifier_attrs["post_transform"],
type(op),
number_of_classes,
op.__dict__,
)

if all(isinstance(i, str) for i in classes):
class_labels = [str(i) for i in classes]
classifier_attrs["classlabels_strings"] = class_labels
Expand Down

0 comments on commit 03db70c

Please sign in to comment.