Skip to content

Conversation

@alexarntzen
Copy link
Contributor

Fixes #1168

@alexarntzen alexarntzen force-pushed the fix_QDA_crashes_on_string_labels branch from eca5ae0 to 169f640 Compare March 4, 2025 18:33
@alexarntzen alexarntzen changed the title Fix QDA converter crashing on string labels in QDA and incorrect shape calculation Fix QDA converter crashing on string labels and incorrect shape calculation Mar 4, 2025
@alexarntzen alexarntzen force-pushed the fix_QDA_crashes_on_string_labels branch from 169f640 to be0cc65 Compare March 4, 2025 18:43
@alexarntzen alexarntzen marked this pull request as draft March 4, 2025 18:44
@alexarntzen alexarntzen marked this pull request as ready for review March 4, 2025 18:44
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
Copy link
Collaborator

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?

Copy link
Contributor Author

@alexarntzen alexarntzen Mar 11, 2025

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.

@xadupre
Copy link
Collaborator

xadupre commented Mar 6, 2025

Can you add a unit test for the new model you added support?

Copy link
Collaborator

@xadupre xadupre left a 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.

@alexarntzen
Copy link
Contributor Author

I added an unit test with string labels for QDA: #6706027

@alexarntzen alexarntzen requested a review from xadupre March 11, 2025 17:17
@xadupre xadupre merged commit f99cdff into onnx:main Mar 18, 2025
23 checks passed
xadupre pushed a commit to xadupre/sklearn-onnx that referenced this pull request Jul 19, 2025
…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]>
xadupre added a commit that referenced this pull request Jul 20, 2025
* 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]>
Amato789 pushed a commit to Amato789/sklearn-onnx that referenced this pull request Jul 21, 2025
* 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]>
Amato789 pushed a commit to Amato789/sklearn-onnx that referenced this pull request Jul 27, 2025
* 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]>
xadupre added a commit that referenced this pull request Jul 28, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QDA converter throws an error when used with string labels

2 participants