Skip to content

Commit

Permalink
Allow empty array as feature_names_out (#832)
Browse files Browse the repository at this point in the history
I don't understand why this should be not allowed.

We use a feature filter step in our pipeline which filters away all features in some cases. This used to work fine with older versions of sklearn before `feature_names_out` and `feature_names_in` were introduced.

Unfortunately, our converter doesn't work anymore because of this check. Removing it resolves the problem.

Signed-off-by: Julian Zimmermann <Julian.Zimmermann@gti.de>
  • Loading branch information
JulZimmermann authored Feb 23, 2022
1 parent 64a7460 commit d2443ca
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions skl2onnx/_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,6 @@ def _parse_sklearn_simple_model(scope, model, inputs, custom_parsers=None,
# Catch a bug in scikit-learn.
out_names = None
this_operator.feature_names_out_ = out_names
if out_names is not None and len(out_names) == 0:
raise RuntimeError(
"get_feature_names_out() cannot return an empty value, "
"model is %r." % type(model))
input_type = guess_tensor_type(inputs[0].type)
variable = scope.declare_local_variable(
'variable', input_type)
Expand Down

0 comments on commit d2443ca

Please sign in to comment.