Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten split helper function import path #271

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
with:
repository: khiopsml/khiops-python-tutorial
path: doc/khiops-python-tutorial
ref: shorten-helpers-path
Copy link
Collaborator

@popescu-v popescu-v Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After approval of this PR, should merge shorten-helpers-path into main in khiops-python-tutorial, then merge the current PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is in a TMP commit.

- name: Add pip scripts directory to path
run: echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"
- name: Install doc build requirements
Expand Down
5 changes: 3 additions & 2 deletions doc/create-doc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fi

# Convert tutorials to reST
tutorials_dir="./tutorials"
tutorials_dir="$(realpath $tutorials_dir)"
mkdir -p "$tutorials_dir"
if [[ $TRANSFORM_NOTEBOOKS ]]
then
Expand All @@ -100,8 +101,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
Expand Down
2 changes: 1 addition & 1 deletion doc/internal/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions doc/samples/samples_sklearn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc/tools/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ These are auxiliary tools for the Khiops Python library.
:toctree: generated
:nosignatures:

utils.helpers
tools
6 changes: 2 additions & 4 deletions khiops/samples/samples_sklearn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions khiops/samples/samples_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions khiops/sklearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
KhiopsEncoder,
KhiopsRegressor,
)
from khiops.sklearn.helpers import train_test_split_dataset
File renamed without changes.
2 changes: 1 addition & 1 deletion khiops/sklearn/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion khiops/utils/helpers.py → khiops/sklearn/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file removed khiops/utils/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/test_dataset_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dataset_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.helpers import train_test_split_dataset


class KhiopsHelperFunctions(unittest.TestCase):
Expand Down
Loading