-
Notifications
You must be signed in to change notification settings - Fork 123
Fix QDA converter crashing on string labels and incorrect shape calculation #1169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix QDA converter crashing on string labels and incorrect shape calculation #1169
Conversation
eca5ae0 to
169f640
Compare
Signed-off-by: Alexander Arntzen <[email protected]>
169f640 to
be0cc65
Compare
Signed-off-by: Alexander Arntzen <[email protected]>
| class_type = onnx_proto.TensorProto.STRING | ||
| class_labels = [s.encode("utf-8") for s in model.classes_] | ||
| else: | ||
| class_type = onnx_proto.TensorProto.INT64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can have mixed types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sklearn supports mixed types. However, the other converters in sklearn-onnx, like LinearDiscriminantAnalysis, do not. For instance:
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from skl2onnx.common.data_types import DoubleTensorType
from skl2onnx import convert_sklearn
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
y = np.array([1, 1, "b", "b"])
skl_model = LinearDiscriminantAnalysis()
skl_model.fit(X, y)
skl_model.classes_ = [1, "b"] # force mixed types
onnx_model = convert_sklearn(
skl_model,
"scikit-learn",
initial_types=[("inputs", DoubleTensorType([None, X.shape[1]]))],
target_opset=16,
options={"zipmap": False},
)outputs:
ValueError: Label types must be all integers or all strings.
|
Can you add a unit test for the new model you added support? |
xadupre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unit test.
Signed-off-by: Alexander Arntzen <[email protected]>
|
I added an unit test with string labels for QDA: #6706027 |
…lation (onnx#1169) * fix crashing on string labels in QDA and incorrect shape calculation Signed-off-by: Alexander Arntzen <[email protected]> * run black Signed-off-by: Alexander Arntzen <[email protected]> * add test with String labels for QDA Signed-off-by: Alexander Arntzen <[email protected]> --------- Signed-off-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Signed-off-by: xadupre <[email protected]>
* update changelogs (#1170) Signed-off-by: xadupre <[email protected]> * remove unused statements in plot_dbegin_options_zipmap.py (#1171) Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: xadupre <[email protected]> * Fix unsued import (#1172) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unused import Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix QDA converter crashing on string labels and incorrect shape calculation (#1169) * fix crashing on string labels in QDA and incorrect shape calculation Signed-off-by: Alexander Arntzen <[email protected]> * run black Signed-off-by: Alexander Arntzen <[email protected]> * add test with String labels for QDA Signed-off-by: Alexander Arntzen <[email protected]> --------- Signed-off-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Signed-off-by: xadupre <[email protected]> * Use onnx-weekly in CI, remove dependency on onnxconveter-common (#1179) * Use onnx-weekly in CI Signed-off-by: xadupre <[email protected]> * remove dependency on onnxconverter-common Signed-off-by: xadupre <[email protected]> * BOOL Signed-off-by: xadupre <[email protected]> * fix wrong import Signed-off-by: xadupre <[email protected]> * fix examples Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Remove import of split_complex_to_pairs (#1182) * update changelogs Signed-off-by: xadupre <[email protected]> * Remove import of `split_complex_to_pairs` It seems to be unused. Signed-off-by: Justin Chu <[email protected]> * fix target opset Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> * fix opset Signed-off-by: xadupre <[email protected]> * fix import Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add action to build the package (#1184) * update changelogs Signed-off-by: xadupre <[email protected]> * Add action to build the package Signed-off-by: xadupre <[email protected]> * fix changelogs Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Migrate to use pyproject to simplify setup (#1186) * Migrate to use pyproject to simplify setup Removed logic in setup.py that parses version etc. and instead use a more simplified pyproject.toml config Signed-off-by: Justin Chu <[email protected]> * classifiers Signed-off-by: Justin Chu <[email protected]> --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Defines action to publish on pypi (#1185) * update changelogs Signed-off-by: xadupre <[email protected]> * Add publish pipeline Signed-off-by: xadupre <[email protected]> * change Signed-off-by: xadupre <[email protected]> * Update .github/workflows/release.yml Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Lint (#1187) * update changelogs Signed-off-by: xadupre <[email protected]> * lint Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * fix release.yml (#1188) * fix release.yml Signed-off-by: xadupre <[email protected]> * fix typo Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix the release package (#1189) * update changelogs Signed-off-by: xadupre <[email protected]> * fix release Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Add a pypi badge on readme (#1190) Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add scikit-learn==1.7.1 to CI Signed-off-by: xadupre <[email protected]> * remove duplicated paragraph Signed-off-by: xadupre <[email protected]> * fix one requirements Signed-off-by: xadupre <[email protected]> * fix ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: Alexander Arntzen <[email protected]> Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Amit Portnoy <[email protected]> Co-authored-by: Alexander Johan Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Justin Chu <[email protected]>
* update changelogs (onnx#1170) Signed-off-by: xadupre <[email protected]> * remove unused statements in plot_dbegin_options_zipmap.py (onnx#1171) Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: xadupre <[email protected]> * Fix unsued import (onnx#1172) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unused import Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix QDA converter crashing on string labels and incorrect shape calculation (onnx#1169) * fix crashing on string labels in QDA and incorrect shape calculation Signed-off-by: Alexander Arntzen <[email protected]> * run black Signed-off-by: Alexander Arntzen <[email protected]> * add test with String labels for QDA Signed-off-by: Alexander Arntzen <[email protected]> --------- Signed-off-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Signed-off-by: xadupre <[email protected]> * Use onnx-weekly in CI, remove dependency on onnxconveter-common (onnx#1179) * Use onnx-weekly in CI Signed-off-by: xadupre <[email protected]> * remove dependency on onnxconverter-common Signed-off-by: xadupre <[email protected]> * BOOL Signed-off-by: xadupre <[email protected]> * fix wrong import Signed-off-by: xadupre <[email protected]> * fix examples Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Remove import of split_complex_to_pairs (onnx#1182) * update changelogs Signed-off-by: xadupre <[email protected]> * Remove import of `split_complex_to_pairs` It seems to be unused. Signed-off-by: Justin Chu <[email protected]> * fix target opset Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> * fix opset Signed-off-by: xadupre <[email protected]> * fix import Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add action to build the package (onnx#1184) * update changelogs Signed-off-by: xadupre <[email protected]> * Add action to build the package Signed-off-by: xadupre <[email protected]> * fix changelogs Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Migrate to use pyproject to simplify setup (onnx#1186) * Migrate to use pyproject to simplify setup Removed logic in setup.py that parses version etc. and instead use a more simplified pyproject.toml config Signed-off-by: Justin Chu <[email protected]> * classifiers Signed-off-by: Justin Chu <[email protected]> --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Defines action to publish on pypi (onnx#1185) * update changelogs Signed-off-by: xadupre <[email protected]> * Add publish pipeline Signed-off-by: xadupre <[email protected]> * change Signed-off-by: xadupre <[email protected]> * Update .github/workflows/release.yml Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Lint (onnx#1187) * update changelogs Signed-off-by: xadupre <[email protected]> * lint Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * fix release.yml (onnx#1188) * fix release.yml Signed-off-by: xadupre <[email protected]> * fix typo Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix the release package (onnx#1189) * update changelogs Signed-off-by: xadupre <[email protected]> * fix release Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Add a pypi badge on readme (onnx#1190) Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add scikit-learn==1.7.1 to CI Signed-off-by: xadupre <[email protected]> * remove duplicated paragraph Signed-off-by: xadupre <[email protected]> * fix one requirements Signed-off-by: xadupre <[email protected]> * fix ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: Alexander Arntzen <[email protected]> Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Amit Portnoy <[email protected]> Co-authored-by: Alexander Johan Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]>
* update changelogs (onnx#1170) Signed-off-by: xadupre <[email protected]> * remove unused statements in plot_dbegin_options_zipmap.py (onnx#1171) Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: xadupre <[email protected]> * Fix unsued import (onnx#1172) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unused import Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix QDA converter crashing on string labels and incorrect shape calculation (onnx#1169) * fix crashing on string labels in QDA and incorrect shape calculation Signed-off-by: Alexander Arntzen <[email protected]> * run black Signed-off-by: Alexander Arntzen <[email protected]> * add test with String labels for QDA Signed-off-by: Alexander Arntzen <[email protected]> --------- Signed-off-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Signed-off-by: xadupre <[email protected]> * Use onnx-weekly in CI, remove dependency on onnxconveter-common (onnx#1179) * Use onnx-weekly in CI Signed-off-by: xadupre <[email protected]> * remove dependency on onnxconverter-common Signed-off-by: xadupre <[email protected]> * BOOL Signed-off-by: xadupre <[email protected]> * fix wrong import Signed-off-by: xadupre <[email protected]> * fix examples Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Remove import of split_complex_to_pairs (onnx#1182) * update changelogs Signed-off-by: xadupre <[email protected]> * Remove import of `split_complex_to_pairs` It seems to be unused. Signed-off-by: Justin Chu <[email protected]> * fix target opset Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> * fix opset Signed-off-by: xadupre <[email protected]> * fix import Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add action to build the package (onnx#1184) * update changelogs Signed-off-by: xadupre <[email protected]> * Add action to build the package Signed-off-by: xadupre <[email protected]> * fix changelogs Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Migrate to use pyproject to simplify setup (onnx#1186) * Migrate to use pyproject to simplify setup Removed logic in setup.py that parses version etc. and instead use a more simplified pyproject.toml config Signed-off-by: Justin Chu <[email protected]> * classifiers Signed-off-by: Justin Chu <[email protected]> --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Defines action to publish on pypi (onnx#1185) * update changelogs Signed-off-by: xadupre <[email protected]> * Add publish pipeline Signed-off-by: xadupre <[email protected]> * change Signed-off-by: xadupre <[email protected]> * Update .github/workflows/release.yml Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Lint (onnx#1187) * update changelogs Signed-off-by: xadupre <[email protected]> * lint Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * fix release.yml (onnx#1188) * fix release.yml Signed-off-by: xadupre <[email protected]> * fix typo Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix the release package (onnx#1189) * update changelogs Signed-off-by: xadupre <[email protected]> * fix release Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Add a pypi badge on readme (onnx#1190) Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add scikit-learn==1.7.1 to CI Signed-off-by: xadupre <[email protected]> * remove duplicated paragraph Signed-off-by: xadupre <[email protected]> * fix one requirements Signed-off-by: xadupre <[email protected]> * fix ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: Alexander Arntzen <[email protected]> Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Amit Portnoy <[email protected]> Co-authored-by: Alexander Johan Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]>
* Add support for GBC with exponential loss Signed-off-by: Maksym Sydorchuk <[email protected]> * refactoring Signed-off-by: Maksym Sydorchuk <[email protected]> * refactoring Signed-off-by: Maksym Sydorchuk <[email protected]> * refactoring Signed-off-by: Maksym Sydorchuk <[email protected]> * add test Signed-off-by: Maksym Sydorchuk <[email protected]> * Add scikit-learn==1.7.1 to CI (#1196) * update changelogs (#1170) Signed-off-by: xadupre <[email protected]> * remove unused statements in plot_dbegin_options_zipmap.py (#1171) Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: xadupre <[email protected]> * Fix unsued import (#1172) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unused import Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix QDA converter crashing on string labels and incorrect shape calculation (#1169) * fix crashing on string labels in QDA and incorrect shape calculation Signed-off-by: Alexander Arntzen <[email protected]> * run black Signed-off-by: Alexander Arntzen <[email protected]> * add test with String labels for QDA Signed-off-by: Alexander Arntzen <[email protected]> --------- Signed-off-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Signed-off-by: xadupre <[email protected]> * Use onnx-weekly in CI, remove dependency on onnxconveter-common (#1179) * Use onnx-weekly in CI Signed-off-by: xadupre <[email protected]> * remove dependency on onnxconverter-common Signed-off-by: xadupre <[email protected]> * BOOL Signed-off-by: xadupre <[email protected]> * fix wrong import Signed-off-by: xadupre <[email protected]> * fix examples Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Remove import of split_complex_to_pairs (#1182) * update changelogs Signed-off-by: xadupre <[email protected]> * Remove import of `split_complex_to_pairs` It seems to be unused. Signed-off-by: Justin Chu <[email protected]> * fix target opset Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> * fix opset Signed-off-by: xadupre <[email protected]> * fix import Signed-off-by: xadupre <[email protected]> * ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add action to build the package (#1184) * update changelogs Signed-off-by: xadupre <[email protected]> * Add action to build the package Signed-off-by: xadupre <[email protected]> * fix changelogs Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Migrate to use pyproject to simplify setup (#1186) * Migrate to use pyproject to simplify setup Removed logic in setup.py that parses version etc. and instead use a more simplified pyproject.toml config Signed-off-by: Justin Chu <[email protected]> * classifiers Signed-off-by: Justin Chu <[email protected]> --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Defines action to publish on pypi (#1185) * update changelogs Signed-off-by: xadupre <[email protected]> * Add publish pipeline Signed-off-by: xadupre <[email protected]> * change Signed-off-by: xadupre <[email protected]> * Update .github/workflows/release.yml Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Lint (#1187) * update changelogs Signed-off-by: xadupre <[email protected]> * lint Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * fix release.yml (#1188) * fix release.yml Signed-off-by: xadupre <[email protected]> * fix typo Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Fix the release package (#1189) * update changelogs Signed-off-by: xadupre <[email protected]> * fix release Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> * Add a pypi badge on readme (#1190) Signed-off-by: Justin Chu <[email protected]> Signed-off-by: xadupre <[email protected]> * Add scikit-learn==1.7.1 to CI Signed-off-by: xadupre <[email protected]> * remove duplicated paragraph Signed-off-by: xadupre <[email protected]> * fix one requirements Signed-off-by: xadupre <[email protected]> * fix ci Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: Alexander Arntzen <[email protected]> Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Co-authored-by: Amit Portnoy <[email protected]> Co-authored-by: Alexander Johan Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Justin Chu <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]> * Fix black formatting issues Signed-off-by: Maksym Sydorchuk <[email protected]> * Enhance OrdinalEncoder conversion to handle infrequent categories (#1195) * Enhance OrdinalEncoder conversion to handle infrequent categories - Added logic to check if infrequent categories are enabled in the OrdinalEncoder. - Introduced handling for `infrequent_categories_` to adjust `values_int64s` accordingly. - Updated conversion process to account for `max_categories` or `min_frequency` by modifying the attribute values for infrequent categories. Signed-off-by: Danil Petrov <[email protected]> * Refactor handling of infrequent categories in OrdinalEncoder conversion - Replaced `current_infrequent_categories_` with `default_to_infrequent_mappings` for clarity. - Updated logic to handle `default_to_infrequent_mappings` when encoding missing values. - Simplified the assignment of `attrs["values_int64s"]` by using `default_to_infrequent_mappings` where applicable. - Ensured consistent handling of `max_categories` or `min_frequency` scenarios. Signed-off-by: Danil Petrov <[email protected]> * Fix linting Signed-off-by: Danil Petrov <[email protected]> * Enable conversion of OrdinalEncoder with max_categories and min_frequency - Added `max_categories_support` function to check scikit-learn version >= 1.3 for `max_categories` and `min_frequency` support in `OrdinalEncoder`. - Updated tests to skip tests if `max_categories` and `min_frequency` are not supported. - Added a check for `_infrequent_enabled` attribute before accessing it to ensure compatibility with older versions of scikit-learn. Signed-off-by: Danil Petrov <[email protected]> * Improve infrequent category handling and missing value encoding in OrdinalEncoder conversion - Modified the condition for checking `_infrequent_enabled` to improve readability. - Ensured correct concatenation of `encoded_missing_value` with `values_int64s` when `default_to_infrequent_mappings` is not None. - Added a test case `SklearnOrdinalEncoderCatList` to verify the conversion of `OrdinalEncoder` with a list of categories. - Updated `dump_data_and_model` call in `SklearnOrdinalEncoderCatList` test for better readability. Signed-off-by: Danil Petrov <[email protected]> --------- Signed-off-by: Danil Petrov <[email protected]> Co-authored-by: Xavier Dupré <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]> * Fixes unknown_value=np.nan in OrdinalEncoder (#1198) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unknown_value=np.nan in OrdinalEncoder Signed-off-by: xadupre <[email protected]> * changelogs Signed-off-by: xadupre <[email protected]> --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]> * Fix CastTransformer output type (#1200) * update changelogs Signed-off-by: xadupre <[email protected]> * Fix unknown_value=np.nan in OrdinalEncoder Signed-off-by: xadupre <[email protected]> * changelogs Signed-off-by: xadupre <[email protected]> * Fix CastTransformer output type Signed-off-by: xadupre <[email protected]> * changes Signed-off-by: xadupre <[email protected]> * disable the test for old version of scikit-learn --------- Signed-off-by: xadupre <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]> * disable zipmap and use onnxruntime backend for exponential loss test Signed-off-by: Maksym Sydorchuk <[email protected]> --------- Signed-off-by: Maksym Sydorchuk <[email protected]> Signed-off-by: xadupre <[email protected]> Signed-off-by: Amit Portnoy <[email protected]> Signed-off-by: Alexander Arntzen <[email protected]> Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Xavier Dupré <[email protected]> Signed-off-by: Danil Petrov <[email protected]> Signed-off-by: Maksym Sydorchuk <[email protected]> Co-authored-by: Maksym Sydorchuk <[email protected]> Co-authored-by: Xavier Dupré <[email protected]> Co-authored-by: Amit Portnoy <[email protected]> Co-authored-by: Alexander Johan Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Alexander Arntzen <[email protected]> Co-authored-by: Justin Chu <[email protected]> Co-authored-by: dpetrovb <[email protected]>
Fixes #1168