Skip to content

Commit bd69a75

Browse files
authored
Merge pull request #399 from KhiopsML/dev-v10
Release 10.3.1.0
2 parents 7cf8c15 + 46c1c24 commit bd69a75

File tree

16 files changed

+268
-85
lines changed

16 files changed

+268
-85
lines changed

.github/workflows/api-docs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
name: API Docs
3+
env:
4+
DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION: 10.3.1.0
35
on:
46
workflow_dispatch:
57
inputs:
@@ -8,6 +10,9 @@ on:
810
required: true
911
type: boolean
1012
default: false
13+
khiops-python-tutorial-revision:
14+
default: 10.3.1.0
15+
description: khiops-python-tutorial repo revision
1116
image-tag:
1217
default: latest
1318
description: Development Docker Image Tag
@@ -44,6 +49,10 @@ jobs:
4449
# https://github.com/actions/runner/issues/2033#issuecomment-1598547465
4550
options: --user 1001
4651
steps:
52+
- name: Set parameters as env
53+
run: |
54+
KHIOPS_PYTHON_TUTORIAL_REVISION=${{ inputs.khiops-python-tutorial-revision || env.DEFAULT_KHIOPS_PYTHON_TUTORIAL_REVISION }}
55+
echo "KHIOPS_PYTHON_TUTORIAL_REVISION=$KHIOPS_PYTHON_TUTORIAL_REVISION" >> "$GITHUB_ENV"
4756
- name: Checkout khiops-python
4857
uses: actions/checkout@v4
4958
with:
@@ -52,6 +61,7 @@ jobs:
5261
uses: actions/checkout@v4
5362
with:
5463
repository: khiopsml/khiops-python-tutorial
64+
ref: ${{ env.KHIOPS_PYTHON_TUTORIAL_REVISION }}
5565
path: doc/khiops-python-tutorial
5666
- name: Add pip scripts directory to path
5767
run: echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"

.github/workflows/conda.yml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Conda Package
33
env:
44
# Note: The default Khiops version must never be an alpha release as they are
55
# ephemeral. To test alpha versions run the workflow manually.
6-
DEFAULT_KHIOPS_CORE_VERSION: 10.3.0
6+
DEFAULT_KHIOPS_CORE_VERSION: 10.3.1
77
DEFAULT_SAMPLES_VERSION: 10.2.4
88
on:
99
workflow_dispatch:
1010
inputs:
1111
khiops-core-version:
12-
default: 10.3.0
12+
default: 10.3.1
1313
description: khiops-core version for testing
1414
khiops-samples-version:
1515
default: 10.2.4
@@ -75,8 +75,9 @@ jobs:
7575
matrix:
7676
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
7777
env:
78-
- {os: ubuntu-20.04, json-image: '{"image": null}'}
78+
- {os: ubuntu-22.04, json-image: '{"image": "ubuntu:20.04"}'}
7979
- {os: ubuntu-22.04, json-image: '{"image": null}'}
80+
- {os: ubuntu-24.04, json-image: '{"image": null}'}
8081
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:8"}'}
8182
- {os: ubuntu-22.04, json-image: '{"image": "rockylinux:9"}'}
8283
- {os: windows-2019, json-image: '{"image": null}'}
@@ -117,7 +118,7 @@ jobs:
117118
PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g")
118119
119120
# Unset *CONDA* environment variables
120-
# As a corrolary, CONDA_PREFIX is unset
121+
# As a corollary, CONDA_PREFIX is unset
121122
# Note: There is no way to remove these variables from GITHUB_ENV
122123
# (see https://github.com/actions/runner/issues/1126)
123124
for CONDA_VAR in $(env | grep CONDA)
@@ -131,17 +132,17 @@ jobs:
131132
run: |
132133
kh-download-datasets \
133134
--version ${{ inputs.khiops-samples-version || env.DEFAULT_SAMPLES_VERSION }}
134-
- name: Test Conda Package on Samples
135+
- name: Run Samples
135136
env:
136137
# Force > 2 CPU cores to launch mpiexec
137138
KHIOPS_PROC_NUMBER: 4
138139
run: |
139-
kh-samples core -i train_predictor -e
140+
kh-samples core -i deploy_model -e
141+
kh-samples core -i deploy_coclustering -e
140142
kh-samples core -i train_predictor_error_handling -e
141-
kh-samples core -i train_coclustering -e
142143
kh-samples sklearn -i khiops_classifier -e
143144
kh-samples sklearn -i khiops_coclustering -e
144-
- name: Test Conda Package on Some Samples (Conda-Based Environments)
145+
- name: Run Samples (Conda-Based Environments)
145146
env:
146147
# Force > 2 CPU cores to launch mpiexec
147148
KHIOPS_PROC_NUMBER: 4
@@ -153,18 +154,57 @@ jobs:
153154
PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g")
154155
155156
# Unset *CONDA* environment variables
156-
# As a corrolary, CONDA_PREFIX is unset
157+
# As a corollary, CONDA_PREFIX is unset
157158
# Note: There is no way to remove these variables from GITHUB_ENV
158159
# (see https://github.com/actions/runner/issues/1126)
159160
for CONDA_VAR in $(env | grep CONDA)
160161
do
161162
unset $(echo $CONDA_VAR | cut -d '=' -f 1)
162163
done
163164
164-
# Execute some Khiops and Khiops Coclustering samples
165+
# Run samples
165166
# Note: kh-samples is not reachable as it is not in PATH
166167
$PYTHON -m khiops.samples.samples -i deploy_model -e
167168
$PYTHON -m khiops.samples.samples -i deploy_coclustering -e
169+
$PYTHON -m khiops.samples.samples -i train_predictor_error_handling -e
170+
$PYTHON -m khiops.samples.samples_sklearn -i khiops_classifier -e
171+
$PYTHON -m khiops.samples.samples_sklearn -i khiops_coclustering -e
172+
# Checkout the sources to obtain the tests
173+
# Note: The `sparse-checkout` option of this action is bugged so we checkout all the sources
174+
# See https://github.com/actions/checkout/issues/1628
175+
- name: Checkout Sources
176+
uses: actions/checkout@v4
177+
with:
178+
fetch-depth: 1
179+
# This is needed so python does not retrieve the khiops module from PWD
180+
- name: Remove the khiops Module from the Sources
181+
run: rm -rf khiops
182+
- name: Install the Test Requirements
183+
run: conda install -y --file test-requirements.txt
184+
- name: Run the Runner Initialization Integration Test
185+
run: |
186+
python -m unittest -v \
187+
tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization
188+
- name: Run the Runner Initialization Integration Test (Conda-Based Environments)
189+
run: |
190+
# Set `python` to the current Conda Python executable
191+
PYTHON="$(type -P python)"
192+
193+
# Remove $CONDA_PREFIX/bin from PATH
194+
PATH=$(echo $PATH | sed "s#$CONDA_PREFIX/bin:##g")
195+
196+
# Unset *CONDA* environment variables
197+
# As a corolary, CONDA_PREFIX is unset
198+
# Note: There is no way to remove these variables from GITHUB_ENV
199+
# (see https://github.com/actions/runner/issues/1126)
200+
for CONDA_VAR in $(env | grep CONDA)
201+
do
202+
unset $(echo $CONDA_VAR | cut -d '=' -f 1)
203+
done
204+
205+
# Execute the runner initialization integration test
206+
$PYTHON -m unittest -v \
207+
tests.test_khiops_integrations.KhiopsRunnerEnvironmentTests.test_runner_environment_initialization
168208
169209
# Release is only executed on tags
170210
# Note: For this job to work the secrets variables KHIOPS_ANACONDA_CHANNEL_TOKEN and

.github/workflows/dev-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Dev Docker
33
env:
4-
DEFAULT_KHIOPS_REVISION: 10.3.0
4+
DEFAULT_KHIOPS_REVISION: 10.3.1
55
DEFAULT_IMAGE_INCREMENT: 0
66
DEFAULT_SERVER_REVISION: main
77
DEFAULT_PYTHON_VERSIONS: 3.8 3.9 3.10 3.11 3.12 3.13
@@ -14,7 +14,7 @@ on:
1414
inputs:
1515
khiops-revision:
1616
type: string
17-
default: 10.3.0
17+
default: 10.3.1
1818
description: Khiops Revision
1919
image-increment:
2020
type: number

.github/workflows/tests.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Tests
33
env:
44
DEFAULT_SAMPLES_REVISION: 10.2.4
5-
DEFAULT_KHIOPS_DESKTOP_REVISION: 10.3.0
5+
DEFAULT_KHIOPS_DESKTOP_REVISION: 10.3.1
66
on:
77
workflow_dispatch:
88
inputs:
@@ -13,7 +13,7 @@ on:
1313
default: latest
1414
description: Development Docker Image Tag
1515
khiops-desktop-revision:
16-
default: 10.3.0
16+
default: 10.3.1
1717
description: Khiops Windows Desktop Application Version
1818
run-expensive-tests:
1919
type: boolean
@@ -109,8 +109,9 @@ jobs:
109109
$CONDA install -y -n "$CONDA_ENV" `grep -v "^\[" khiops.egg-info/requires.txt`
110110
rm -rf khiops.egg-info
111111
done
112-
- name: Prepare Tests Environment
113-
if: github.ref != 'dev' && github.rev != 'dev-v10' && github.ref != 'main' && ! inputs.run-expensive-tests
112+
- name: Configure Expensive Tests Setting
113+
# Skip expensive tests by default, unless on the `dev`, `dev-v10` or `main` branches
114+
if: github.ref != 'dev' && github.ref != 'dev-v10' && github.ref != 'main' && ! inputs.run-expensive-tests
114115
run: echo "SKIP_EXPENSIVE_TESTS=true" >> "$GITHUB_ENV"
115116
- name: Prepare Integration Tests on remote files
116117
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ tests/resources/scenario_generation/api/*/output
4848
tests/resources/scenario_generation/general_options/output
4949
tests/resources/scenario_generation/runner_version/output
5050
tests/resources/*/copy_output_kdic
51+
tests/resources/scenario_generation/system_settings/output
5152

5253
# File generated by documentation scripts/notebooks
5354
kh_samples

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
- Example: 10.2.1.4 is the 5th version that supports khiops 10.2.1.
77
- Internals: Changes in *Internals* sections are unlikely to be of interest for data scientists.
88

9+
## 10.3.1.0 - 2025-04-16
10+
11+
### Added
12+
- (`sklearn`) Support for boolean and float targets in `KhiopsClassifier`.
13+
14+
### Fixed
15+
- (`sklearn`) Crash when there were no informative trees in predictors.
16+
17+
### Deprecated
18+
- (`core`) The `build_multi_table_dictionary_domain` helper function.
19+
920
## 10.3.0.0 - 2025-02-10
1021

1122
### Fixed

khiops/core/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import khiops.core.internals.filesystems as fs
2222
from khiops.core.dictionary import DictionaryDomain, read_dictionary_file
2323
from khiops.core.exceptions import KhiopsRuntimeError
24-
from khiops.core.helpers import build_multi_table_dictionary_domain
24+
from khiops.core.helpers import _build_multi_table_dictionary_domain
2525
from khiops.core.internals.common import (
2626
CommandLineOptions,
2727
SystemSettings,
@@ -1943,8 +1943,7 @@ def build_multi_table_dictionary(
19431943
19441944
.. warning::
19451945
This method is *deprecated* since Khiops 10.1.3 and will be removed in Khiops
1946-
11. Use the `.build_multi_table_dictionary_domain` helper function to
1947-
the same effect.
1946+
11.
19481947
19491948
Parameters
19501949
----------
@@ -1979,7 +1978,7 @@ def build_multi_table_dictionary(
19791978
# Generate multi-table domain by using the eponymous helper function
19801979
# Honor exception API:
19811980
try:
1982-
multi_table_domain = build_multi_table_dictionary_domain(
1981+
multi_table_domain = _build_multi_table_dictionary_domain(
19831982
dictionary_domain, root_dictionary_name, secondary_table_variable_name
19841983
)
19851984
except TypeError as error:

khiops/core/dictionary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def add_dictionary(self, dictionary):
186186
187187
Parameters
188188
----------
189-
dictionary : `DictionaryDomain`
189+
dictionary : `Dictionary`
190190
The dictionary to be added.
191191
192192
Raises

khiops/core/helpers.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import platform
1010
import subprocess
11+
import warnings
1112

1213
import khiops.core.internals.filesystems as fs
1314
from khiops.core import api
@@ -19,6 +20,7 @@
1920
)
2021
from khiops.core.internals.common import (
2122
create_unambiguous_khiops_path,
23+
deprecation_message,
2224
is_list_like,
2325
type_error_message,
2426
)
@@ -29,6 +31,22 @@ def build_multi_table_dictionary_domain(
2931
):
3032
"""Builds a multi-table dictionary domain from a dictionary with a key
3133
34+
.. note::
35+
36+
This is a special-purpose function whose goal is to assist in preparing the
37+
coclustering deployment.
38+
39+
This function builds a new root dictionary and adds it to an existing dictionary
40+
domain.
41+
The new root dictionary only contains one field, which references a preexisting
42+
dictionary from the input dictionary domain as a new (secondary) Table variable.
43+
The preexisting dictionary must have a key set on it, as this is the join key
44+
with the new root table.
45+
46+
.. warning::
47+
This method is *deprecated* since Khiops 10.3.1.0 and will be removed in Khiops
48+
11.
49+
3250
Parameters
3351
----------
3452
dictionary_domain : `.DictionaryDomain`
@@ -38,6 +56,11 @@ def build_multi_table_dictionary_domain(
3856
secondary_table_variable_name : str
3957
Name, in the root dictionary, for the "table" variable of the secondary table.
4058
59+
Returns
60+
-------
61+
`.DictionaryDomain`
62+
The new dictionary domain
63+
4164
Raises
4265
------
4366
`TypeError`
@@ -47,6 +70,16 @@ def build_multi_table_dictionary_domain(
4770
- the dictionary domain doesn't contain at least a dictionary
4871
- the dictionary domain's root dictionary doesn't have a key set
4972
"""
73+
# Warn the user that this helper function is deprecated and will be removed
74+
warnings.warn(deprecation_message("build_multi_table_dictionary_domain", "11.0.0"))
75+
return _build_multi_table_dictionary_domain(
76+
dictionary_domain, root_dictionary_name, secondary_table_variable_name
77+
)
78+
79+
80+
def _build_multi_table_dictionary_domain(
81+
dictionary_domain, root_dictionary_name, secondary_table_variable_name
82+
):
5083
# Check that `dictionary_domain` is a `DictionaryDomain`
5184
if not isinstance(dictionary_domain, DictionaryDomain):
5285
raise TypeError(
@@ -266,7 +299,7 @@ def deploy_coclustering(
266299
# Create a root dictionary containing the keys
267300
root_dictionary_name = "CC_" + dictionary_name
268301
table_variable_name = "Table_" + dictionary_name
269-
domain = build_multi_table_dictionary_domain(
302+
domain = _build_multi_table_dictionary_domain(
270303
tmp_domain, root_dictionary_name, table_variable_name
271304
)
272305

khiops/sklearn/dataset.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import numpy as np
1616
import pandas as pd
17+
import sklearn
1718
from scipy import sparse as sp
1819
from sklearn.utils import check_array
1920
from sklearn.utils.validation import column_or_1d
@@ -430,6 +431,19 @@ def write_internal_data_table(dataframe, file_path_or_stream):
430431
)
431432

432433

434+
def _column_or_1d_with_dtype(y, dtype=None):
435+
# 'dtype' has been introduced on `column_or_1d' since Scikit-learn 1.2;
436+
if sklearn.__version__ < "1.2":
437+
if pd.api.types.is_string_dtype(dtype) and y.isin(["True", "False"]).all():
438+
warnings.warn(
439+
"'y' stores strings restricted to 'True'/'False' values: "
440+
"The predict method may return a bool vector."
441+
)
442+
return column_or_1d(y, warn=True)
443+
else:
444+
return column_or_1d(y, warn=True, dtype=dtype)
445+
446+
433447
class Dataset:
434448
"""A representation of a dataset
435449
@@ -738,8 +752,22 @@ def _init_target_column(self, y):
738752
if isinstance(y, str):
739753
y_checked = y
740754
else:
741-
y_checked = column_or_1d(y, warn=True)
742-
755+
if hasattr(y, "dtype"):
756+
if isinstance(y.dtype, pd.CategoricalDtype):
757+
y_checked = _column_or_1d_with_dtype(
758+
y, dtype=y.dtype.categories.dtype
759+
)
760+
else:
761+
y_checked = _column_or_1d_with_dtype(y, dtype=y.dtype)
762+
elif hasattr(y, "dtypes"):
763+
if isinstance(y.dtypes[0], pd.CategoricalDtype):
764+
y_checked = _column_or_1d_with_dtype(
765+
y, dtype=y.dtypes[0].categories.dtype
766+
)
767+
else:
768+
y_checked = _column_or_1d_with_dtype(y)
769+
else:
770+
y_checked = _column_or_1d_with_dtype(y)
743771
# Check the target type coherence with those of X's tables
744772
if isinstance(
745773
self.main_table, (PandasTable, SparseTable, NumpyTable)

0 commit comments

Comments
 (0)