Skip to content

Re-enable compressed cache for fetch_kddcup99 - #33118

Merged
ogrisel merged 9 commits into
scikit-learn:mainfrom
un1u3:fix-20newgroups-403-error
Jan 26, 2026
Merged

ogrisel merged 9 commits into
scikit-learn:mainfrom
un1u3:fix-20newgroups-403-error

Conversation

@un1u3

@un1u3 un1u3 commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33117

Re-enable compressed cache for `fetch_kddcup99

Why

The KDDCup99 cache is currently forced to be written uncompressed due to a legacy
decompression workaround. This significantly inflates disk usage for a very large
dataset. Re-enabling compression reduces storage requirements and disk I/O without
changing the public API or user-facing behavior.

What changed

  • Write cached samples and targets using joblib.dump(..., compress=3) in
    _kddcup99.py.
  • Add a regression test in test_kddcup99.py that builds a compressed cache and
    verifies that fetch_kddcup99 can load it correctly without network access.

Review focus

  • Confirm that the chosen compression level (compress=3) is a reasonable
    trade-off between cache size reduction and CPU overhead.
  • Validate that the new test reliably covers loading from a compressed cache and
    does not require network access.

AI usage disclosure

This pull request includes code checks and PR enhancement using AI.

un1u3 added 2 commits January 5, 2026 20:35
…share URL has been returning 403 forbidden errors since Dec 27,2024. This commit updates the download url to use the MIT CSAIL mirror which is currently accessible, Fixes scikit-learn#33002

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to sklearn/_min_dependencies.py, the oldest supported version of joblib is 1.3.0 (and the current version is 1.5.3).

I installed this version locally, deleted ~/scikit_learn_data/kddcup99_10-py3 and then I tried to run:

SKLEARN_SKIP_NETWORK_TESTS=0 pytest -vl sklearn/datasets/tests/test_kddcup99.py

All tests pass.

So this confirms that we don't observe the old joblib compression bug anymore.

The resulting local folder is much smaller, as expected:

$ du -hs ~/scikit_learn_data/kddcup99_10-py3
 18M    /Users/ogrisel/scikit_learn_data/kddcup99_10-py3

It used to be on the order of 100 MB.

Could you please add a changelog entry for this fix? See: https://github.com/scikit-learn/scikit-learn/blob/main/doc/whats_new/upcoming_changes/README.md

Comment thread sklearn/datasets/_twenty_newsgroups.py Resolved
Comment thread sklearn/datasets/tests/test_kddcup99.py Resolved
@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Jan 21, 2026
@un1u3

un1u3 commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

@ogrisel
sorry I did some mistakes pushing contents of other earlier issues
now its fixed you may take a look

@ogrisel

ogrisel commented Jan 21, 2026

Copy link
Copy Markdown
Member

Please fix the linter problem and add the changelog entry as detailed in my last comment.

@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Jan 22, 2026
@un1u3

un1u3 commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

@ogrisel

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Besides the following, LGTM.

@@ -0,0 +1,2 @@
- Re-enabled compressed caching for :func:`datasets.fetch_kddcup99`, reducing
on-disk cache size without changing the public API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could also rename this filename to 33118.efficiency.rst since this is a disk space optimization.

@un1u3
un1u3 requested a review from ogrisel January 23, 2026 14:32
@un1u3

un1u3 commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

@ogrisel

@ogrisel

ogrisel commented Jan 23, 2026

Copy link
Copy Markdown
Member

The coverage failure is normal. This part of the code is not necessarily triggered because we don't want to download data each time on all CI workers and maybe the ones that actually do are not collecting the coverage data.

@ogrisel

ogrisel commented Jan 23, 2026 •

Copy link
Copy Markdown
Member

Let's wait for a second reviewer to have a look, otherwise I plan to merge in a short while.

@ogrisel ogrisel added the Quick Review For PRs that are quick to review label Jan 23, 2026
@ogrisel
ogrisel merged commit e2bea55 into scikit-learn:main Jan 26, 2026
@un1u3
un1u3 deleted the fix-20newgroups-403-error branch February 5, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:datasets Quick Review For PRs that are quick to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fetch_kddcup99 cache written uncompressed due to legacy decompression workaround

2 participants