From 4da7e7467b69cf8cbe136d9beaf34a38762772ec Mon Sep 17 00:00:00 2001 From: PrimozGodec Date: Fri, 15 Sep 2023 14:14:47 +0200 Subject: [PATCH 1/2] Adapt tests to xgboost=2 --- .../model/tests/test_owgradientboosting.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Orange/widgets/model/tests/test_owgradientboosting.py b/Orange/widgets/model/tests/test_owgradientboosting.py index 0ab57a5d381..a59de79be60 100644 --- a/Orange/widgets/model/tests/test_owgradientboosting.py +++ b/Orange/widgets/model/tests/test_owgradientboosting.py @@ -36,6 +36,14 @@ from Orange.widgets.widget import OWWidget +def get_tree_train_params(model): + ln = json.loads(model.skl_model.get_booster().save_config())["learner"] + try: + return ln["gradient_booster"]["tree_train_param"] + except KeyError: + return ln["gradient_booster"]["updater"]["grow_colmaker"]["train_param"] + + def create_parent(editor_class): class DummyWidget(OWWidget): name = "Mock" @@ -158,9 +166,7 @@ def test_default_parameters_cls(self): booster = XGBClassifier() model = booster(data) params = model.skl_model.get_params() - booster_params = json.loads(model.skl_model.get_booster().save_config()) - updater = booster_params["learner"]["gradient_booster"]["updater"] - tp = updater["grow_colmaker"]["train_param"] + tp = get_tree_train_params(model) self.assertEqual(params["n_estimators"], self.editor.n_estimators) self.assertEqual( round(float(tp["learning_rate"]), 1), self.editor.learning_rate @@ -178,9 +184,7 @@ def test_default_parameters_reg(self): booster = XGBRegressor() model = booster(data) params = model.skl_model.get_params() - booster_params = json.loads(model.skl_model.get_booster().save_config()) - updater = booster_params["learner"]["gradient_booster"]["updater"] - tp = updater["grow_colmaker"]["train_param"] + tp = get_tree_train_params(model) self.assertEqual(params["n_estimators"], self.editor.n_estimators) self.assertEqual( round(float(tp["learning_rate"]), 1), self.editor.learning_rate @@ -223,9 +227,7 @@ def test_default_parameters_cls(self): booster = XGBRFClassifier() model = booster(data) params = model.skl_model.get_params() - booster_params = json.loads(model.skl_model.get_booster().save_config()) - updater = booster_params["learner"]["gradient_booster"]["updater"] - tp = updater["grow_colmaker"]["train_param"] + tp = get_tree_train_params(model) self.assertEqual(params["n_estimators"], self.editor.n_estimators) self.assertEqual( round(float(tp["learning_rate"]), 1), self.editor.learning_rate @@ -243,9 +245,7 @@ def test_default_parameters_reg(self): booster = XGBRFRegressor() model = booster(data) params = model.skl_model.get_params() - booster_params = json.loads(model.skl_model.get_booster().save_config()) - updater = booster_params["learner"]["gradient_booster"]["updater"] - tp = updater["grow_colmaker"]["train_param"] + tp = get_tree_train_params(model) self.assertEqual(params["n_estimators"], self.editor.n_estimators) self.assertEqual( round(float(tp["learning_rate"]), 1), self.editor.learning_rate From 68b5d5f03055238434816f4be71abe6b058808f0 Mon Sep 17 00:00:00 2001 From: PrimozGodec Date: Fri, 15 Sep 2023 14:13:17 +0200 Subject: [PATCH 2/2] Allways install xgboost and catboost --- .github/workflows/test.yml | 4 ---- conda-recipe/meta.yaml | 2 ++ requirements-core.txt | 2 ++ requirements-opt.txt | 2 -- requirements-readthedocs.txt | 2 -- tox.ini | 3 +-- 6 files changed, 5 insertions(+), 10 deletions(-) delete mode 100644 requirements-opt.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbdb95bb714..d3c81bd30d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -148,10 +148,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install system dependencies on MacOS - run: brew install libomp - if: runner.os == 'macOS' - - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 3688ad46e50..f6a68a0cccb 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -69,6 +69,8 @@ requirements: - cachecontrol >=0.12.6 - qtconsole >=4.7.2 - pygments >=2.8.0 + - catboost >=1.0.1 + - xgboost >=1.7.4 test: # Python imports diff --git a/requirements-core.txt b/requirements-core.txt index 1a4d7d4856a..02ae1d7bc91 100644 --- a/requirements-core.txt +++ b/requirements-core.txt @@ -26,3 +26,5 @@ pandas>=1.4.0,!=1.5.0,!=2.0.0 pyyaml openpyxl httpx>=0.21.0 +catboost>=1.0.1 +xgboost>=1.7.4 diff --git a/requirements-opt.txt b/requirements-opt.txt deleted file mode 100644 index ab79b32dc86..00000000000 --- a/requirements-opt.txt +++ /dev/null @@ -1,2 +0,0 @@ -catboost>=1.0.1 -xgboost>=1.5.0 diff --git a/requirements-readthedocs.txt b/requirements-readthedocs.txt index 7db6a67749f..05d72518dd7 100644 --- a/requirements-readthedocs.txt +++ b/requirements-readthedocs.txt @@ -3,6 +3,4 @@ cython -r requirements-doc.txt -r requirements-gui.txt -r requirements-pyqt.txt -# for orange data mining library catboost and xgboost required --r requirements-opt.txt -e . diff --git a/tox.ini b/tox.ini index 825bb490a47..1b261425183 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,6 @@ deps = pyqt5==5.15.*;platform_system!="Windows" or python_version>='3.10' pyqtwebengine==5.12.*;platform_system=="Windows" and python_version<'3.10' pyqtwebengine==5.15.*;platform_system!="Windows" or python_version>='3.10' - -r {toxinidir}/requirements-opt.txt coverage psycopg2-binary pymssql<3.0 @@ -66,7 +65,7 @@ deps = # oldest: pyyaml # oldest: openpyxl oldest: httpx==0.21.0 - oldest: xgboost==1.5.0 + oldest: xgboost==1.7.4 oldest: catboost==1.0.1 commands_pre =