Commit Graph

112 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
756bb268eb
[pre-commit.ci] pre-commit autoupdate (#6629)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0)
- [github.com/asottile/pyupgrade: v2.37.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.37.0...v2.38.2)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.9.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/3.9.2...5.0.4)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.981)
- [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.1)

* Fix a long line

* Update sol1.py

* Update sol1.py

* lambda_

* Update multi_level_feedback_queue.py

* Update double_ended_queue.py

* Update sequential_minimum_optimization.py

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-03 22:00:45 +02:00
AHTESHAM ZAIDI
707809b000
Update astar.py (#6456)
* Update astar.py

Improved comments added punctuations.

* Update astar.py

* Update machine_learning/astar.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update astar.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
2022-10-02 23:55:24 +02:00
Todor Peev
ba129de7f3
Fixes: 6216 | Support vector machines (#6240)
* initial commit

* first implementation of hard margin

* remove debugging print

* many commits squashed because pre-commit was buggy

* more kernels and improved kernel management

* remove unnecessary code + fix names + formatting + doctests

* rename to fit initial naming

* better naming and documentation

* better naming and documentation
2022-07-11 12:42:07 +02:00
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 (#6245)
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0

* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
Erik Parmann
4a51244e0f
Remove how-to example for support vector machine (#6201) 2022-06-24 01:00:55 +08:00
Christian Clauss
24d3cf8244
The black formatter is no longer beta (#5960)
* The black formatter is no longer beta

* pre-commit autoupdate

* pre-commit autoupdate

* Remove project_euler/problem_145 which is killing our CI tests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-01-30 20:29:54 +01:00
Venkatesh Tantravahi
508589e3fc
Local Weighted Learning (#5615)
* Local Weighted Learning Added

* Delete LWL directory

* Local Weighted Learning Added

* local weighted learning added

* Delete LWL directory

* Delete local_weighted_learning.py

* rephrased code added

* local weight learning updated

* local weight learning updated

* Updated dir

* updated codespell

* import modification

* Doctests added

* doctests updated

* lcl updated

* doctests updated

* doctest values updated
2021-10-31 12:27:50 +01:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
Jenil Shah
7d7c7972ae
Updated name from lstm_prediction.py_tf to lstm_prediction.py and also imported keras (#4422)
* Updated name from lstm_prediction.py_lf to lstm_prediction.py and also imported keras

* Edited the changes

* tensorflow 2.5 is has shipped!!!

* Update lstm_prediction.py

* Update lstm_prediction.py

* One blank line, not two?

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-17 14:28:04 +02:00
Dhruv Manilawala
6f21f76696
fix(ci): Update pre-commit hooks and apply new black (#4359)
* fix(ci): Update pre-commit hooks and apply new black

* remove empty docstring
2021-04-26 07:46:50 +02:00
algobytewise
9b60be67af
[mypy] fix small folders 2 (#4293)
* Update perceptron.py

* Update binary_tree_traversals.py

* fix machine_learning

* Update build.yml

* Update perceptron.py

* Update machine_learning/forecasting/run.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-26 12:21:16 +01:00
Christian Clauss
987567360e
Update our pre-commit dependencies (#4273)
* .pre-commit-config.yaml: mypy directories that pass

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-20 10:42:17 +05:30
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
Steve Kim
d594f4556c
[mypy] Add/fix type annotations for similarity search in machine learning (#4088)
* [mypy] Add/fix type annotations for similarity search in machine learning

* fix annotation

* fix annotation (Union)

* isort
2021-01-22 10:10:21 +05:30
Christian Clauss
3fdbf9741d
Python 3.9 (#3926)
* Upgrade to Python 3.9

* pip install wheel for faster builds

* updating DIRECTORY.md

* requirements.txt: tensorflow; python_version < '3.9'

* keras requires tensorflow

* Rename lstm_prediction.py to lstm_prediction.py_tf

* Update requirements.txt

* updating DIRECTORY.md

* Update requirements.txt

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-24 12:41:10 +01:00
Dhruv Manilawala
b9b7fffcc2
Move CI tests from Travis to GitHub (#3889)
* Add initial support for moving tests to GitHub

* Add setup Python step in the workflow

* Remove Travis CI config file

* Fix GitHub action file for build to trigger on PR

* Use Python 3.8 as tensorflow is not yet supported

* Fix ciphers.hill_cipher doctest error

* Fix: instagram crawler tests failing on GitHub actions

* Fix floating point errors in doctest

* Small change to test cache

* Apply suggestions from code review

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update instagram_crawler.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-19 22:01:31 +05:30
Steve Kim
ae4d7d4d04
add similarity_search.py in machine_learning (#3864)
* add similarity_search.py in machine_learning
adding similarity_search algorithm in machine_learning

* fix pre-commit test, apply feedback

isort, codespell changed.
applied feedback(np -> np.ndarray)

* apply feedback

add type hints to euclidean method

* apply feedback

- changed euclidean's type hints
- changed few TypeError to ValueError
- changed range(len()) to enumerate()
- changed error's strings to f-string
- implemented without type()
- add euclidean's explanation

* apply feedback

- deleted try/catch in euclidean
- added error tests
- name change(value -> value_array)

* # doctest: +NORMALIZE_WHITESPACE

* Update machine_learning/similarity_search.py

* placate flake8

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-13 15:26:17 +01:00
poloso
4851942ec0
Reduce complexity linear_discriminant_analysis. (#2452)
* Reduce complexity linear_discriminant_analysis.

* Fix whitespace

* Update machine_learning/linear_discriminant_analysis.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* fixup! Format Python code with psf/black push

* Fix format to surpass pre-commit tests

* updating DIRECTORY.md

* Update machine_learning/linear_discriminant_analysis.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* fixup! Format Python code with psf/black push

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-11 08:05:11 +05:30
Nandiya
12c69800bd
Forecast (#3219)
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <fvfyk3gehv22@FVFYK3GEHV22s-MacBook-Pro.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-24 16:07:27 +02:00
Christian Clauss
9b95e4f662
Pyupgrade to python3.8 (#3616)
* Upgrade to Python 3.8 syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-21 12:46:14 +02:00
Dhruv
acaeb22bbd
Add GitHub action for pre-commit (#2515)
* Add GitHub action file for pre-commit

* Fix errors exposed by pre-commit hook:

- Remove executable bit from files without shebang. I checked those
  file and it was not needed.
- Fix with black

* Apply suggestions from code review

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-30 15:23:34 +02:00
Dhruv
0a42ae9095
Fix all errors mentioned in pre-commit run (#2512)
* Fix all errors mentioned in pre-commit run:

- Fix end of file
- Remove trailing whitespace
- Fix files with black
- Fix imports with isort

* Fix errors
2020-09-30 10:38:00 +02:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Abdoulaye Balde
7446e69571
Gradient Boosting Regressor (#2298)
* Stock market prediction using greadient boosting

* To reverse a string using stack

* To reverse string using stack

* Predict Stock Prices Python & Machine Learning

* Gradient boosting regressor on boston dataset

* Gradient boosting regressor implementation

* Gradient boosting regressor

* Gradient boosting regressor

* Gradient boosting regressor

* Removing files

* GradientBoostingRegressor example

* Demo Gradient Boosting

* Demo Gradient boosting

* demo of gradient boosting

* gradient boosting demo

* Fix spelling mistake

* Fix formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-09-26 16:58:29 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Tanuj Dhiman
25946e4570
Update scoring_functions.py (#2291)
* Update scoring_functions.py

We can find accuracy by manually if we are not going to use sklearn library.

* Update scoring_functions.py

* Update machine_learning/scoring_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-09 19:04:46 +02:00
Shubham Shaswat
a1d1a44f51
added idf-smooth (#2174)
* added idf-smooth

* added idf-smooth

* added idf-smooth
2020-09-02 19:33:12 +02:00
BAKEZQ
d402cd0b6e
Fix SettingWithCopy warning by pandas (#2346)
* Fix SettingWithCopy warning in pandas

https://github.com/TheAlgorithms/Python/issues/2282

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py

* Update k_means_clust.py
2020-08-23 13:40:57 +02:00
Dan Murphy
1f1c3b0e4b
Added Normalization and Standardization Algorithms (#2192)
* Added Standardization and Normalization algorithms with built-in stats

* Implement ndigits for rounding

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-10 15:36:51 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
cd3e8f95a0
isort --profile black --recursive . (#2170)
* isort --profile black --recursive .

* Update codespell.yml

* typo: vertices

* typo: Explanation

* typo: Explanation

* Fix typos
2020-07-06 08:48:18 +05:30
vinayak
2d3d660155
black fixes and Travis CI fixes (#2160)
* black format

* updating DIRECTORY.md

* fixes

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-02 20:02:15 +05:30
Christian Clauss
8ab84fd794
Only one carriage return (#2155)
* updating DIRECTORY.md

* touch

* fixup! Format Python code with psf/black push

* Update word_frequency_functions.py

* updating DIRECTORY.md

* Update word_frequency_functions.py

* Update lfu_cache.py

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-25 19:15:30 +02:00
Dan Murphy
b368b1ecfd
NLP Word Frequency Algorithms (#2142)
* NLP Word Frequency Algorithms

* Added type hints and Wikipedia link to tf-idf

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Fix line length for flake8

* Fix line length for flake8 V2

* Add line escapes and change int to float

* Corrected doctests

* Fix for TravisCI

* Fix for TravisCI V2

* Tests passing locally

* Tests passing locally

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/word_frequency_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Add doctest examples and clean up docstrings

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-25 10:00:43 +02:00
beqakd
d034add61f
add visualization of k means clustering as excel format (#2104)
* add visualization of kmneas clust as excel format

* style changes

* style changes

* Add doctest and typehint!

* style change

* Update machine_learning/k_means_clust.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update machine_learning/k_means_clust.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-19 17:55:13 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Erwin Lejeune
21ed8968c0
Fixes in Bidirectional A* (#2020)
* implement bidirectional astar

* add type hints

* add wikipedia url

* format with black

* changes from review

* fix collision check

* Add testmod()

* # doctest: +NORMALIZE_WHITESPACE

* Codespell: euclidean

* Codespell: coordinates

* Codespell: traversal

* Codespell: remaining

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-21 21:50:52 +02:00
Christian Clauss
a7cd633bb6
Fix astar (#1966)
* Fix astar

Single character variable names are old school.

* fixup! Format Python code with psf/black push

* Tuple

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-10 20:49:40 +05:30
Jeffin Francis
77c3e5b74b
Added A* algorithm (#1913)
* a* algorithm

* changes after build error

* intent changes

* fix after review

* ImportMissmatchError

* Build failed fix

* doctest changes

* doctest changes
2020-05-10 00:37:36 +05:30
Jeffin Francis
8a8527f1bd
Added Lstm example for stock predection (#1908)
* Added Lstm example for stock predection

* Changes after review

* changes after build failed

* Add Kiera’s to requirements.txt

* requirements.txt: Add keras and tensorflow

* psf/black

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-07 08:53:44 +02:00
QuantumNovice
9bb57fbbfe
support_vector_machines.py increase error tolerance to suppress convergence warnings (#1929)
* Update support_vector_machines.py

* Update support_vector_machines.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-02 21:19:45 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Prince Gangurde
8c01da20d6
Update random_forest_regressor.py (#1880) 2020-04-17 12:43:50 +02:00
Prince Gangurde
b64c4af296
Create gaussian_naive_bayes.py (#1861)
* Create Gaussian_Naive_Bayes.py

Added Gaussian Naive Bayes algorithm in the module machine learning

* Rename Gaussian_Naive_Bayes.py to gaussian_naive_bayes.py

* requirements.txt: pip install xgboost

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-17 09:38:44 +08:00
Prince Gangurde
7ffdef2636
Fix some typos in random forest classifier (#1858) 2020-04-13 02:15:48 +02:00
Miggelito
10fc90c7bd
Added Random Forest Classifier (#1738)
* Added Random Forest Regressor

* Updated file to standard

* Added Random Forest Classifier (Iris dataset) and a Confusion Matrix for result visualization
2020-03-13 09:13:43 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
Miggelito
f52b97f2c5
Added Random Forest Regressor and tested with flake8 (#1733)
* Added Random Forest Regressor

* Updated file to standard
2020-02-08 00:07:14 +05:30