Skip to content

Commit dcdef4a

Browse files
Merge pull request #211 from KhiopsML/176-add-deprecation-warnings-for-removals-in-khiops-v11
176 add deprecation warnings for removals in khiops v11
2 parents 27c9f62 + 4395564 commit dcdef4a

File tree

2 files changed

+78
-5
lines changed

2 files changed

+78
-5
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Release
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: Version of the release
8+
jobs:
9+
release:
10+
runs-on: ubuntu-22.04
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v4
16+
with:
17+
ref: main
18+
# Get Git tags so that versioneer can function correctly
19+
# See issue https://github.com/actions/checkout/issues/701
20+
fetch-depth: 0
21+
- name: Update "main" branch
22+
run: |-
23+
# Merge dev into main, tag the merge commit
24+
git merge --no-ff -m'Merge branch 'dev' for release ${{ inputs.version }}' dev
25+
git tag ${{ inputs.version }}
26+
27+
# Make dev point to main
28+
git switch dev
29+
git reset --hard main
30+
31+
# Update remotes
32+
git switch dev
33+
git push
34+
git switch main
35+
git push

khiops/core/api.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def _preprocess_task_arguments(task_args):
199199
else:
200200
if not task_args["target_variable"] and task_args[
201201
"discretization_method"
202-
] not in ("EqualWidth", "EqualLenght", "None"):
202+
] not in ("EqualWidth", "EqualFrequency", "None"):
203203
raise ValueError(
204204
"'discretization_method' must be either "
205205
"'EqualWidth', 'EqualFrequency' or 'None'."
@@ -261,6 +261,44 @@ def _preprocess_task_arguments(task_args):
261261
if isinstance(task_args["selection_value"], (int, float)):
262262
task_args["selection_value"] = str(task_args["selection_value"])
263263

264+
# Warn the simple deprecations for Khiops 11
265+
simple_khiops_11_deprecations = [
266+
("max_groups", "the upcoming 'max_parts' parameter", 0),
267+
("max_intervals", "the upcoming 'max_parts' parameter", 0),
268+
("min_group_frequency", None, 0),
269+
("min_interval_frequency", None, 0),
270+
("results_prefix", None, ""),
271+
("snb_predictor", None, True),
272+
("univariate_predictor_number", None, 0),
273+
]
274+
for param, replacement_param, param_default_value in simple_khiops_11_deprecations:
275+
if param in task_args and task_args[param] != param_default_value:
276+
warnings.warn(
277+
deprecation_message(
278+
f"'{param}'", "11.0.0", replacement=replacement_param, quote=False
279+
)
280+
)
281+
282+
# Warn the grouping/interval supervised method deprecation values for Khiops 11
283+
if "target_variable" in task_args and task_args["target_variable"] != "":
284+
if "grouping_method" in task_args and task_args["grouping_method"] != "MODL":
285+
warnings.warn(
286+
deprecation_message(
287+
"'grouping_method' on supervised learning", "11.0.0", quote=False
288+
)
289+
)
290+
if (
291+
"discretization_method" in task_args
292+
and task_args["discretization_method"] != "MODL"
293+
):
294+
warnings.warn(
295+
deprecation_message(
296+
f"'discretization_method' on supervised learning",
297+
"11.0.0",
298+
quote=False,
299+
)
300+
)
301+
264302
return task_called_with_domain
265303

266304

@@ -679,8 +717,8 @@ def train_predictor(
679717
Maximum number of variables pairs to construct.
680718
specific_pairs : list of tuple, optional
681719
User-specified pairs as a list of 2-tuples of variable names. If a given tuple
682-
contains only one non-empty string generated within the maximum limit
683-
``max_pairs``.
720+
contains only one non-empty variable name, then it generates all the pairs
721+
containing it (within the limit ``max_pairs``).
684722
all_possible_pairs : bool, default ``True``
685723
If ``True`` tries to create all possible pairs within the limit ``max_pairs``.
686724
The pairs and variables given in ``specific_pairs`` have priority.
@@ -989,8 +1027,8 @@ def train_recoder(
9891027
Maximum number of variables pairs to construct.
9901028
specific_pairs : list of tuple, optional
9911029
User-specified pairs as a list of 2-tuples of variable names. If a given tuple
992-
contains only one non-empty string generated within the maximum limit
993-
``max_pairs``.
1030+
contains only one non-empty variable name, then it generates all the pairs
1031+
containing it (within the limit ``max_pairs``).
9941032
all_possible_pairs : bool, default ``True``
9951033
If ``True`` tries to create all possible pairs within the limit ``max_pairs``.
9961034
The pairs and variables given in ``specific_pairs`` have priority.

0 commit comments

Comments
 (0)