From beb3014a9483ae238596af69a46636813b5aa445 Mon Sep 17 00:00:00 2001 From: Thierry RAMORASOAVINA Date: Tue, 3 Feb 2026 18:39:37 +0100 Subject: [PATCH] Make the default value of `n_features` match the khiops core value - KhiopsClassifier, KhiopsRegressor, KhiopsEncoder --- CHANGELOG.md | 7 +++++-- khiops/sklearn/estimators.py | 16 ++++++++-------- tests/test_sklearn.py | 9 +++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ed6a29..2a8f5ded 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,14 @@ ## Unreleased ### Added -- (`sklearn`) `n_feature_parts` parameter to the supervised estimators +- (`sklearn`) `n_feature_parts` parameter to the supervised estimators + +### Fixed +- (`sklearn`) Default value of `n_features` for the supervised estimators ## 11.0.0.2 - 2026-01-26 -## Fixed +### Fixed - (`core`) Samples dir path construction when HOME is a remote path ## 11.0.0.1 - 2026-01-14 diff --git a/khiops/sklearn/estimators.py b/khiops/sklearn/estimators.py index 1af5d06f..157f20c3 100644 --- a/khiops/sklearn/estimators.py +++ b/khiops/sklearn/estimators.py @@ -1188,7 +1188,7 @@ class KhiopsSupervisedEstimator(KhiopsEstimator): def __init__( self, - n_features=100, + n_features=1000, n_trees=10, n_text_features=10000, type_text_features="words", @@ -1513,7 +1513,7 @@ class KhiopsPredictor(KhiopsSupervisedEstimator): def __init__( self, - n_features=100, + n_features=1000, n_trees=10, n_text_features=10000, type_text_features="words", @@ -1656,7 +1656,7 @@ class KhiopsClassifier(ClassifierMixin, KhiopsPredictor): Parameters ---------- - n_features : int, default 100 + n_features : int, default 1000 Maximum number of features to construct automatically. See :doc:`/multi_table_primer` for more details on the multi-table-specific features. @@ -1748,7 +1748,7 @@ class KhiopsClassifier(ClassifierMixin, KhiopsPredictor): def __init__( self, - n_features=100, + n_features=1000, n_pairs=0, n_trees=10, n_text_features=10000, @@ -2076,7 +2076,7 @@ class KhiopsRegressor(RegressorMixin, KhiopsPredictor): Parameters ---------- - n_features : int, default 100 + n_features : int, default 1000 Maximum number of features to construct automatically. See :doc:`/multi_table_primer` for more details on the multi-table-specific features. @@ -2141,7 +2141,7 @@ class KhiopsRegressor(RegressorMixin, KhiopsPredictor): def __init__( self, - n_features=100, + n_features=1000, n_trees=0, n_text_features=10000, type_text_features="words", @@ -2283,7 +2283,7 @@ class KhiopsEncoder(TransformerMixin, KhiopsSupervisedEstimator): ---------- categorical_target : bool, default ``True`` ``True`` if the target column is categorical. - n_features : int, default 100 + n_features : int, default 1000 Maximum number of features to construct automatically. See :doc:`/multi_table_primer` for more details on the multi-table-specific features. @@ -2390,7 +2390,7 @@ class KhiopsEncoder(TransformerMixin, KhiopsSupervisedEstimator): def __init__( self, categorical_target=True, - n_features=100, + n_features=1000, n_pairs=0, n_trees=0, n_text_features=10000, diff --git a/tests/test_sklearn.py b/tests/test_sklearn.py index c8312fca..c06a35f2 100644 --- a/tests/test_sklearn.py +++ b/tests/test_sklearn.py @@ -753,6 +753,7 @@ def setUpClass(cls): "field_separator": "\t", "detect_format": False, "header_line": True, + "max_constructed_variables": 333, "max_pairs": 1, "max_trees": 5, "max_text_features": 300000, @@ -785,6 +786,7 @@ def setUpClass(cls): "field_separator": "\t", "detect_format": False, "header_line": True, + "max_constructed_variables": 555, "max_trees": 0, "max_text_features": 300000, "text_features": "ngrams", @@ -813,6 +815,7 @@ def setUpClass(cls): "field_separator": "\t", "detect_format": False, "header_line": True, + "max_constructed_variables": 777, "max_pairs": 1, "max_trees": 5, "max_text_features": 300000, @@ -1432,6 +1435,7 @@ def test_parameter_transfer_classifier_fit_from_monotable_dataframe(self): schema_type="monotable", source_type="dataframe", extra_estimator_kwargs={ + "n_features": 333, "n_pairs": 1, "n_trees": 5, "n_text_features": 300000, @@ -1456,6 +1460,7 @@ def test_parameter_transfer_classifier_fit_from_monotable_dataframe_with_df_y( schema_type="monotable", source_type="dataframe_xy", extra_estimator_kwargs={ + "n_features": 333, "n_pairs": 1, "n_trees": 5, "n_text_features": 300000, @@ -1519,6 +1524,7 @@ def test_parameter_transfer_encoder_fit_from_monotable_dataframe(self): schema_type="monotable", source_type="dataframe", extra_estimator_kwargs={ + "n_features": 777, "n_pairs": 1, "n_trees": 5, "n_text_features": 300000, @@ -1546,6 +1552,7 @@ def test_parameter_transfer_encoder_fit_from_monotable_dataframe_with_df_y( schema_type="monotable", source_type="dataframe_xy", extra_estimator_kwargs={ + "n_features": 777, "n_pairs": 1, "n_trees": 5, "n_text_features": 300000, @@ -1615,6 +1622,7 @@ def test_parameter_transfer_regressor_fit_from_monotable_dataframe(self): schema_type="monotable", source_type="dataframe", extra_estimator_kwargs={ + "n_features": 555, "n_selected_features": 1, "n_evaluated_features": 3, "n_text_features": 300000, @@ -1634,6 +1642,7 @@ def test_parameter_transfer_regressor_fit_from_monotable_dataframe_with_df_y( schema_type="monotable", source_type="dataframe_xy", extra_estimator_kwargs={ + "n_features": 555, "n_selected_features": 1, "n_evaluated_features": 3, "n_text_features": 300000,