* added lstm algorithm in neural network section.
* commented the testing lines of code
* modified code to meet contribution.md file guidelines
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add LSTM algorithm implementation in neural network section
* shorten the individual lines
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* shorten the lines
* Refactor LSTM input data initialization
* Refactor LSTM network implementation and improve code readability
* changed code a bit for meet ruff standards
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Refactor LSTM class to improve code readability and maintainability
* Refactor tqdm import in LSTM class
* Refactor tqdm import in LSTM class
* added doc tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* descriptive names + improved doctests
* Refactor LSTM class: Increase training epochs to 100
* Refactor LSTM class: Improve test method and add comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added doct tests for each function
* added type hints in lstm init
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed type hints which were repeating in code
* written doc tests for backward pass and forward pass, fixed variable names in sigmoid function from x to input array
* fixed return type of test function to str from none
* Refactor LSTM implementation and clean up code
Removed author information and unused print statements. Updated parameter names in docstrings for consistency.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename stm_model to lstm_model in lstm.py
* Fix parameter name in sigmoid and tanh methods
* updating DIRECTORY.md
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
Per discussion in #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.
* Create README.md
* Update README.md
* Add files via upload
* Delete llm_experiments directory
* Create README.md
* Add files via upload
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add files via upload
* Delete neural_network/chatbot/main.py
* Delete neural_network/chatbot/llm_service.py
* Delete neural_network/chatbot/chatbot.py
* Delete neural_network/chatbot/db.py
* Update README.md
* Add files via upload
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add files via upload
made changes suggested by auto-checker
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add files via upload
* Add files via upload
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Delete neural_network/chatbot directory
* Add files via upload
* Add files via upload
* Add files via upload
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add files via upload
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updating DIRECTORY.md
* Rename batch_size variable to _batch_size
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* feat: add softsign activation function
* refactor: formatting
* refactor: detailed docs
* Fix reference link in softsign.py docstring
Updated the reference link for the softsign activation function.
* updating DIRECTORY.md
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Add Adagrad optimizer implementation
- Implements Adagrad (Adaptive Gradient) using pure NumPy
- Adapts learning rate individually for each parameter
- Includes comprehensive docstrings and type hints
- Adds doctests for validation
- Provides usage example demonstrating convergence
- Follows PEP8 coding standards
- Part of issue #13662
* Add Adam and Nesterov Accelerated Gradient optimizers
- Implements Adam (Adaptive Moment Estimation) optimizer
- Implements Nesterov Accelerated Gradient (NAG) optimizer
- Both use pure NumPy without deep learning frameworks
- Includes comprehensive docstrings and type hints
- Adds doctests for validation
- Provides usage examples demonstrating convergence
- Follows PEP8 coding standards
- Part of issue #13662
* updating DIRECTORY.md
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Fix formatting and grammar in CONTRIBUTING.md 🍉
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* commited
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Warp long line 72 to placate rumdl in pre-commit
CONTRIBUTING.md:72:351: [MD013] Line length 376 exceeds 350 characters
* Revise pre-commit instructions and docstring guidelines
Updated the CONTRIBUTING.md file to clarify pre-commit plugin usage and improve docstring requirements.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Improve comments guidelines in CONTRIBUTING.md
Reorganize comments on code explanation for clarity.
* Update forward propagation reference link
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: umang-dadhich <umang-dadhich@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix ty invalid assignment diagnostics
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix unused typing import
* Fix gradient accumulation type handling
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix automatic differentiation gradient dtype handling
---------
Co-authored-by: kadubhumika <kadubhumika@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Re-enable the four scikit-learn machine-learning examples and the
neural-network perceptron that had been disabled (renamed to
.broken.txt / .DISABLED), and modernize them so they import and run
cleanly on current scikit-learn and pass the doctest CI:
machine_learning/gaussian_naive_bayes.py
machine_learning/random_forest_classifier.py
- Replace the removed sklearn.metrics.plot_confusion_matrix with
ConfusionMatrixDisplay.from_estimator (removed in scikit-learn 1.2).
- Drop the artificial time.sleep() calls.
machine_learning/gradient_boosting_regressor.py
machine_learning/random_forest_regressor.py
- Replace the removed load_boston dataset (removed in scikit-learn
1.2 for ethical reasons) with the bundled load_diabetes dataset so
the examples run offline.
- Avoid an unused-variable lint (RUF059).
neural_network/perceptron.py
- Use a dedicated seeded random.Random instance instead of the global
random state, so training is reproducible and thread-safe under the
parallel test runner.
- Cap training at epoch_number epochs so it always terminates even on
non-linearly-separable data (previously an unbounded while True).
- Have training() and sort() return their results instead of printing,
per the contribution guidelines, and update the doctests accordingly.
Requested by @cclauss in #8029; perceptron follow-up to #15206.
2026-09-06 18:52:09 +02:00
Christian Claussandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit autoupdate 2025-09-11
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maths/dual_number_automatic_differentiation.py
* Update maths/dual_number_automatic_differentiation.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dual_number_automatic_differentiation.py
* Update dual_number_automatic_differentiation.py
* No <fin-streamer> tag with the specified data-test attribute found.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Enable ruff ICN001 rule
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* added GELU activation functions file
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update gaussian_error_linear_unit.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update gaussian_error_linear_unit.py
* Delete neural_network/activation_functions/gaussian_error_linear_unit.py
* Rename maths/gaussian_error_linear_unit.py to neural_network/activation_functions/gaussian_error_linear_unit.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create ipconversion.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update conversions/ipconversion.py
* Update ipconversion.py
* Rename ipconversion.py to ipv4_conversion.py
* forward_propagation(32, 450_000) # Was 10_000_000
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* avg and mps speed formulae added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* avg and mps speed formulae added
* fixed_spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ws
* added amicable numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added amicable numbers
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed
* changed name of file and added code improvements
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* issues fixed due to pi
* requested changes added
* Created doppler_effect_of_sound.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated doppler_effect_of_sound.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added desc names
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed spacing
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* renamed doppler_effect_of_sound.py to doppler_frequency.py
* used expection handling rather than print statements
* fixed spacing for ruff
* Update doppler_frequency.py
This is super slick! Well done.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added A General Swish Activation Function inNeural Networks
* Added the general swish function in the SiLU function and renamed it as swish.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Shivansh Bhatnagar <shivansh.bhatnagar.mat22@iitbhu.ac.in>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* Fix deprecation warning in 2_hidden_layers_neural_network.py
Fix numpy deprecation warning:
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Add binary step activation function
* fix: ruff line too long error
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: add link to directory
* revert: add link to directory
* fix: algorithm bug and docs
* Update neural_network/activation_functions/binary_step.py
* fix: ruff line too long error
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Added Squareplus Activation Function
* Added parameter beta to the function
* Fixed Squareplus Function
* Update neural_network/activation_functions/squareplus.py
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Moved file relu.py from maths/ to neural_network/activation_functions
* Renamed relu.py to rectified_linear_unit.py
* Renamed relu.py to rectified_linear_unit.py in DIRECTORY.md
* Added Scaled Exponential Linear Unit Activation Function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update scaled_exponential_linear_unit.py
* Update scaled_exponential_linear_unit.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update scaled_exponential_linear_unit.py
* Update scaled_exponential_linear_unit.py
* Update scaled_exponential_linear_unit.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update scaled_exponential_linear_unit.py
* Update scaled_exponential_linear_unit.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Style sigmoid function in harmony with pep guideness
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Fix ruff errors
Renamed neural_network/input_data.py to neural_network/input_data.py_tf
because it should be left out of the directory for the following
reasons:
1. Its sole purpose is to be used by neural_network/gan.py_tf, which is
itself left out of the directory because of issues with TensorFlow.
2. It was taken directly from TensorFlow's codebase and is actually
already deprecated. If/when neural_network/gan.py_tf is eventually
re-added back to the directory, its implementation should be changed
to not use neural_network/input_data.py anyway.
* updating DIRECTORY.md
* Change input_data.py_tf file extension
Change input_data.py_tf file extension because algorithms-keeper bot is being picky about it
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* tanh function been added
* tanh function been added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function is added
* tanh function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tanh function added
* tanh function added
* tanh function is added
* Apply suggestions from code review
* ELU activation function is added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* elu activation is added
* ELU activation is added
* Update maths/elu_activation.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Exponential_linear_unit activation is added
* Exponential_linear_unit activation is added
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Remove python_version < "3.11" for tensorflow
* Reenable neural_network/input_data.py_tf
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
* Try to fix ruff
* Try to fix ruff
* Try to fix pre-commit
* Try to fix
* Fix
* Fix
* Reenable dynamic_programming/k_means_clustering_tensorflow.py_tf
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>