Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG Fixes fetch_kddcup99 for return_X_y and as_frame #19011

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

Merged
Merged
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
6 changes: 3 additions & 3 deletions 6 sklearn/datasets/_kddcup99.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ def fetch_kddcup99(*, subset=None, data_home=None, shuffle=False,
with open(join(module_path, 'descr', 'kddcup99.rst')) as rst_file:
fdescr = rst_file.read()

if return_X_y:
return data, target

frame = None
if as_frame:
frame, data, target = _convert_data_dataframe(
"fetch_kddcup99", data, target, feature_names, target_names
)

if return_X_y:
return data, target

return Bunch(
data=data,
target=target,
Expand Down
8 changes: 8 additions & 0 deletions 8 sklearn/datasets/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ def check_as_frame(bunch, dataset_func,
if expected_target_dtype is not None:
assert np.all(frame_bunch.target.dtypes == expected_target_dtype)

# Test for return_X_y and as_frame=True
frame_X, frame_y = dataset_func(as_frame=True, return_X_y=True)
assert isinstance(frame_X, pd.DataFrame)
if frame_y.ndim > 1:
assert isinstance(frame_X, pd.DataFrame)
else:
assert isinstance(frame_y, pd.Series)


def _skip_network_tests():
return os.environ.get('SKLEARN_SKIP_NETWORK_TESTS', '1') == '1'
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be:

Suggested change
return os.environ.get('SKLEARN_SKIP_NETWORK_TESTS', '1') == '1'
return os.environ.get('SKLEARN_SKIP_NETWORK_TESTS', '0') == '1'

by default?

Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion, but I was surprise to get those checks skipped by default on my local setup.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we have no network as default to make it easier for repo maintainers such as debian. (One less configuration to set)

On a side note, it would be nice to have a [ci network] to enable this test on the CI for PRs.

Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion, but I was surprise to get those checks skipped by default on my local setup.

I got a little surprised at first as well :)

Copy link
Member

Choose a reason for hiding this comment

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

+1 for [ci network]. In another PR.

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.