Skip to content

Fix: Use secure HTTPS and automatic extraction for MovieLens dataset#2241

Open
jaytiwarihub wants to merge 8 commits intokeras-team:masterfrom
jaytiwarihub:fix-movielens-loader
Open

Fix: Use secure HTTPS and automatic extraction for MovieLens dataset#2241
jaytiwarihub wants to merge 8 commits intokeras-team:masterfrom
jaytiwarihub:fix-movielens-loader

Conversation

@jaytiwarihub
Copy link

Description

Updated the MovieLens dataset loader to use the secure https protocol (replacing http) and replaced manual zipfile extraction with the built-in keras.utils.get_file(..., extract=True) utility.

Changes

  1. Changed dataset URL from http:// to https:// for security.
  2. Removed redundant ZipFile extraction code.
  3. Enabled extract=True in get_file to handle caching and extraction automatically.

Test Plan

  • Verified that the ml-latest-small.zip file downloads and extracts correctly to ~/.keras/datasets/.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jaytiwarihub, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the data loading and preparation steps across several Keras examples. The primary goal is to improve the security of data acquisition by enforcing HTTPS for dataset downloads and to simplify the extraction process by utilizing Keras's built-in utilities or providing clear, programmatic extraction methods. These changes contribute to more secure, reliable, and user-friendly example code by automating common data setup tasks.

Highlights

  • Enhanced Security for Data Downloads: The MovieLens dataset download URL has been updated from HTTP to HTTPS, ensuring secure data transfer.
  • Streamlined Dataset Extraction: Manual zipfile extraction for the MovieLens dataset has been replaced by leveraging keras.utils.get_file's built-in extract=True functionality. Similar automatic extraction is now used for the aclImdb dataset.
  • Improved Dataset Handling Logic: The speaker recognition example now includes explicit checks for dataset existence and programmatic extraction using zipfile, providing clearer guidance if the dataset is not found.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves dataset handling in several examples. For text_classification_from_scratch.py and collaborative_filtering_movielens.py, it correctly replaces manual download/extraction steps with keras.utils.get_file, and for the latter, it also laudably updates the URL to use secure HTTPS. These changes make the examples more robust and easier to run. However, the changes in examples/audio/speaker_recognition_using_cnn.py seem out of scope, as they introduce manual extraction logic rather than using keras.utils.get_file. I've provided some suggestions to improve code clarity and reduce redundancy in that file.

Copy link
Collaborator

@sachinprasadhs sachinprasadhs left a comment

Choose a reason for hiding this comment

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

Remove the newly added .ipynb file.

You only make changes to the .py file and the .ipynb and .md file can be generated through the script mentioned here https://github.com/keras-team/keras-io/blob/master/README.md#previewing-a-new-example


# Download the actual data from http://files.grouplens.org/datasets/movielens/ml-latest-small.zip"
# Use the ratings.csv file
# FIX: Use HTTPS and let Keras handle extraction automatically
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can remove this comment.

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants