Skip to content

Remove tensorflow/keras files and the keras dependency - #15420

Open
priya-sundaram-dev wants to merge 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:remove-tf-keras
Open

priya-sundaram-dev wants to merge 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:remove-tf-keras

Conversation

@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

Reopens the cleanup from #15418 (my earlier #15419 was auto-closed by the keeper bot for an unmarked checklist — this PR fills it in).

Closes the cleanup discussed in #15418.

These four files aren't algorithms — they're how-to-use scripts that wrap a deep-learning framework, and they were the only thing dragging in the heavy keras/tensorflow stack:

  • computer_vision/cnn_classification.py
  • dynamic_programming/k_means_clustering_tensorflow.py
  • machine_learning/lstm/lstm_prediction.py
  • neural_network/input_data.py — a TensorFlow MNIST data loader; git grep confirms nothing under a collected .py path imports it.

I also removed the now-orphaned machine_learning/lstm/ package (only __init__.py + sample_data.csv, which existed solely for lstm_prediction.py).

Cleanups

  • Dropped keras>=3.7 from pyproject.toml and ran uv sync --upgrade && uv lock. The lock now resolves 80 packages; removed absl-py, h5py, keras, ml-dtypes, namex, optree (plus minor bumps to fonttools/httpcore2/httpx2 from --upgrade).
  • Removed the # keras needs hdf5 on pre-release Python libhdf5-dev install step from both build.yml and sphinx.yml — it only existed for keras.
  • Dropped the four now-dead --ignore= entries in build.yml.
  • Removed the four DIRECTORY.md entries and the empty Lstm heading.

Verification

  • git grep -i -E 'tensorflow|keras' now returns only English dictionary words in strings/anagrams.txt / strings/words.txt (kerasin/kerasine), never the library.
  • Both workflow files still parse as valid YAML.

One thing left in place

neural_network/gan.py_tf still import input_data, but its .py_tf extension means it is not collected or executed anywhere, and it's out of scope for this PR. Happy to remove or restore it separately if you'd like.


Describe your change

Checklist

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. — N/A: this is a coordinated removal of four non-algorithm files + the orphaned lstm/ package, as agreed in Should we remove dependencies keras and tensorflow? #15418.
  • All new Python files are placed inside an existing directory. — N/A (no new files).
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints. — N/A (removal-only).
  • All functions have doctests that pass the automated testing. — N/A (removal-only).
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation. — N/A (removal-only).

Per discussion in TheAlgorithms#15418, these four files are not algorithms (they are
how-to-use scripts wrapping a deep-learning framework) and dragged in the
heavy keras/tensorflow dependency stack:

- computer_vision/cnn_classification.py
- dynamic_programming/k_means_clustering_tensorflow.py
- machine_learning/lstm/lstm_prediction.py
- neural_network/input_data.py (TF MNIST data loader; nothing imports it)

Also removes the now-orphaned machine_learning/lstm/ package (only
__init__.py + sample_data.csv, which served lstm_prediction.py).

Cleanups:
- Drop keras from pyproject.toml dependencies; regenerate uv.lock
  (removes absl-py, h5py, keras, ml-dtypes, namex, optree).
- Remove the pre-release libhdf5-dev install step from build.yml and
  sphinx.yml (it existed only because keras needs hdf5).
- Drop the four stale pytest --ignore entries in build.yml.
- Remove the four DIRECTORY.md entries and the empty Lstm heading.
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Sep 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant