diff --git a/doc/create-doc b/doc/create-doc index 1de0c1ac..57bd2bf6 100755 --- a/doc/create-doc +++ b/doc/create-doc @@ -78,7 +78,7 @@ then fi # Convert tutorials to reST -tutorials_dir="./tutorials" +tutorials_dir="$(realpath ./tutorials)" mkdir -p "$tutorials_dir" if [[ $TRANSFORM_NOTEBOOKS ]] then @@ -100,8 +100,8 @@ python create-coursework.py cd coursework mkdir -p exercises touch exercises/.dummy # Create a dummy so the "exercises" directory is created on unzip -zip "../../$tutorials_dir/core_tutorials.zip" Core*.ipynb data/*/* exercises/.dummy -zip "../../$tutorials_dir/sklearn_tutorials.zip" Sklearn*.ipynb data/*/* exercises/.dummy +zip "$tutorials_dir/core_tutorials.zip" Core*.ipynb data/*/* exercises/.dummy +zip "$tutorials_dir/sklearn_tutorials.zip" Sklearn*.ipynb data/*/* exercises/.dummy cd "../.." # Create the documentation with Sphinx diff --git a/doc/internal/index.rst b/doc/internal/index.rst index db8301e0..1531433b 100644 --- a/doc/internal/index.rst +++ b/doc/internal/index.rst @@ -3,7 +3,7 @@ Internals These are internal modules with no "data science" functionality. Their documentation is available for completeness. -.. currentmodule:: khiops.utils +.. currentmodule:: khiops.sklearn .. autosummary:: :nosignatures: :toctree: generated diff --git a/doc/samples/samples_sklearn.rst b/doc/samples/samples_sklearn.rst index f5ce17b8..9693ba27 100644 --- a/doc/samples/samples_sklearn.rst +++ b/doc/samples/samples_sklearn.rst @@ -155,8 +155,7 @@ Samples import os import pandas as pd from khiops import core as kh - from khiops.sklearn import KhiopsClassifier - from khiops.utils.helpers import train_test_split_dataset + from khiops.sklearn import KhiopsClassifier, train_test_split_dataset from sklearn import metrics # Load the dataset into pandas dataframes @@ -211,8 +210,7 @@ Samples import os import pandas as pd from khiops import core as kh - from khiops.sklearn import KhiopsClassifier - from khiops.utils.helpers import train_test_split_dataset + from khiops.sklearn import KhiopsClassifier, train_test_split_dataset from sklearn import metrics # Load the dataset tables into dataframes diff --git a/doc/tools/index.rst b/doc/tools/index.rst index 162cc3be..f6c1a7cf 100644 --- a/doc/tools/index.rst +++ b/doc/tools/index.rst @@ -7,5 +7,4 @@ These are auxiliary tools for the Khiops Python library. :toctree: generated :nosignatures: - utils.helpers tools diff --git a/khiops/samples/samples_sklearn.ipynb b/khiops/samples/samples_sklearn.ipynb index c79fe141..66bab90b 100644 --- a/khiops/samples/samples_sklearn.ipynb +++ b/khiops/samples/samples_sklearn.ipynb @@ -167,8 +167,7 @@ "import os\n", "import pandas as pd\n", "from khiops import core as kh\n", - "from khiops.sklearn import KhiopsClassifier\n", - "from khiops.utils.helpers import train_test_split_dataset\n", + "from khiops.sklearn import KhiopsClassifier, train_test_split_dataset\n", "from sklearn import metrics\n", "\n", "# Load the dataset into pandas dataframes\n", @@ -236,8 +235,7 @@ "import os\n", "import pandas as pd\n", "from khiops import core as kh\n", - "from khiops.sklearn import KhiopsClassifier\n", - "from khiops.utils.helpers import train_test_split_dataset\n", + "from khiops.sklearn import KhiopsClassifier, train_test_split_dataset\n", "from sklearn import metrics\n", "\n", "# Load the dataset tables into dataframes\n", diff --git a/khiops/samples/samples_sklearn.py b/khiops/samples/samples_sklearn.py index afca3259..b6fa0bee 100644 --- a/khiops/samples/samples_sklearn.py +++ b/khiops/samples/samples_sklearn.py @@ -148,8 +148,7 @@ def khiops_classifier_multitable_star(): import os import pandas as pd from khiops import core as kh - from khiops.sklearn import KhiopsClassifier - from khiops.utils.helpers import train_test_split_dataset + from khiops.sklearn import KhiopsClassifier, train_test_split_dataset from sklearn import metrics # Load the dataset into pandas dataframes @@ -207,8 +206,7 @@ def khiops_classifier_multitable_snowflake(): import os import pandas as pd from khiops import core as kh - from khiops.sklearn import KhiopsClassifier - from khiops.utils.helpers import train_test_split_dataset + from khiops.sklearn import KhiopsClassifier, train_test_split_dataset from sklearn import metrics # Load the dataset tables into dataframes diff --git a/khiops/sklearn/__init__.py b/khiops/sklearn/__init__.py index 10159e2f..e1b7f33b 100644 --- a/khiops/sklearn/__init__.py +++ b/khiops/sklearn/__init__.py @@ -11,3 +11,4 @@ KhiopsEncoder, KhiopsRegressor, ) +from khiops.sklearn.helpers import train_test_split_dataset diff --git a/khiops/utils/dataset.py b/khiops/sklearn/dataset.py similarity index 100% rename from khiops/utils/dataset.py rename to khiops/sklearn/dataset.py diff --git a/khiops/sklearn/estimators.py b/khiops/sklearn/estimators.py index 79176f3a..127cde5f 100644 --- a/khiops/sklearn/estimators.py +++ b/khiops/sklearn/estimators.py @@ -50,7 +50,7 @@ is_list_like, type_error_message, ) -from khiops.utils.dataset import ( +from khiops.sklearn.dataset import ( Dataset, FileTable, get_khiops_variable_name, diff --git a/khiops/utils/helpers.py b/khiops/sklearn/helpers.py similarity index 98% rename from khiops/utils/helpers.py rename to khiops/sklearn/helpers.py index 2b16c5e8..c390693d 100644 --- a/khiops/utils/helpers.py +++ b/khiops/sklearn/helpers.py @@ -5,7 +5,7 @@ from sklearn.model_selection import train_test_split from khiops.core.internals.common import is_dict_like, type_error_message -from khiops.utils.dataset import Dataset, FileTable +from khiops.sklearn.dataset import Dataset, FileTable # Note: We build the splits with lists and itertools.chain avoid pylint warning about # unbalanced-tuple-unpacking. See issue https://github.com/pylint-dev/pylint/issues/5671 diff --git a/khiops/utils/__init__.py b/khiops/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/test_dataset_class.py b/tests/test_dataset_class.py index be0034c6..d626428d 100644 --- a/tests/test_dataset_class.py +++ b/tests/test_dataset_class.py @@ -17,7 +17,7 @@ from pandas.testing import assert_frame_equal from sklearn import datasets -from khiops.utils.dataset import Dataset +from khiops.sklearn.dataset import Dataset class DatasetInputOutputConsistencyTests(unittest.TestCase): diff --git a/tests/test_dataset_errors.py b/tests/test_dataset_errors.py index 457d6529..d00a6660 100644 --- a/tests/test_dataset_errors.py +++ b/tests/test_dataset_errors.py @@ -14,7 +14,7 @@ import pandas as pd from khiops.core.internals.common import type_error_message -from khiops.utils.dataset import Dataset, FileTable, PandasTable +from khiops.sklearn.dataset import Dataset, FileTable, PandasTable # Disable PEP8 variable names because of scikit-learn X,y conventions diff --git a/tests/test_helper_functions.py b/tests/test_helper_functions.py index 34f4a9d4..91f50139 100644 --- a/tests/test_helper_functions.py +++ b/tests/test_helper_functions.py @@ -16,7 +16,7 @@ from khiops.core.dictionary import DictionaryDomain from khiops.core.helpers import build_multi_table_dictionary_domain, visualize_report -from khiops.utils.helpers import train_test_split_dataset +from khiops.sklearn import train_test_split_dataset class KhiopsHelperFunctions(unittest.TestCase):