mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
[mypy] fix compression folder (#4290)
* Update lempel_ziv.py * Update build.yml * updating DIRECTORY.md * fix doctest in 2_hidden_layers_neural_network.py * one more doctest * simplified tests Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
0ee8f792e3
commit
a8db5d4b93
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
|
@ -28,6 +28,7 @@ jobs:
|
|||
blockchain
|
||||
boolean_algebra
|
||||
cellular_automata
|
||||
compression
|
||||
computer_vision
|
||||
fractals
|
||||
fuzzy_logic
|
||||
|
|
40
DIRECTORY.md
40
DIRECTORY.md
|
@ -46,6 +46,7 @@
|
|||
|
||||
## Cellular Automata
|
||||
* [Conways Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/cellular_automata/conways_game_of_life.py)
|
||||
* [Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/cellular_automata/game_of_life.py)
|
||||
* [One Dimensional](https://github.com/TheAlgorithms/Python/blob/master/cellular_automata/one_dimensional.py)
|
||||
|
||||
## Ciphers
|
||||
|
@ -322,6 +323,7 @@
|
|||
* [Kahns Algorithm Long](https://github.com/TheAlgorithms/Python/blob/master/graphs/kahns_algorithm_long.py)
|
||||
* [Kahns Algorithm Topo](https://github.com/TheAlgorithms/Python/blob/master/graphs/kahns_algorithm_topo.py)
|
||||
* [Karger](https://github.com/TheAlgorithms/Python/blob/master/graphs/karger.py)
|
||||
* [Markov Chain](https://github.com/TheAlgorithms/Python/blob/master/graphs/markov_chain.py)
|
||||
* [Minimum Spanning Tree Boruvka](https://github.com/TheAlgorithms/Python/blob/master/graphs/minimum_spanning_tree_boruvka.py)
|
||||
* [Minimum Spanning Tree Kruskal](https://github.com/TheAlgorithms/Python/blob/master/graphs/minimum_spanning_tree_kruskal.py)
|
||||
* [Minimum Spanning Tree Kruskal2](https://github.com/TheAlgorithms/Python/blob/master/graphs/minimum_spanning_tree_kruskal2.py)
|
||||
|
@ -407,6 +409,8 @@
|
|||
* [Basic Maths](https://github.com/TheAlgorithms/Python/blob/master/maths/basic_maths.py)
|
||||
* [Binary Exp Mod](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exp_mod.py)
|
||||
* [Binary Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation.py)
|
||||
* [Binary Exponentiation 2](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation_2.py)
|
||||
* [Binary Exponentiation 3](https://github.com/TheAlgorithms/Python/blob/master/maths/binary_exponentiation_3.py)
|
||||
* [Binomial Coefficient](https://github.com/TheAlgorithms/Python/blob/master/maths/binomial_coefficient.py)
|
||||
* [Binomial Distribution](https://github.com/TheAlgorithms/Python/blob/master/maths/binomial_distribution.py)
|
||||
* [Bisection](https://github.com/TheAlgorithms/Python/blob/master/maths/bisection.py)
|
||||
|
@ -417,8 +421,9 @@
|
|||
* [Decimal Isolate](https://github.com/TheAlgorithms/Python/blob/master/maths/decimal_isolate.py)
|
||||
* [Entropy](https://github.com/TheAlgorithms/Python/blob/master/maths/entropy.py)
|
||||
* [Euclidean Distance](https://github.com/TheAlgorithms/Python/blob/master/maths/euclidean_distance.py)
|
||||
* [Euclidean Gcd](https://github.com/TheAlgorithms/Python/blob/master/maths/euclidean_gcd.py)
|
||||
* [Euler Method](https://github.com/TheAlgorithms/Python/blob/master/maths/euler_method.py)
|
||||
* [Eulers Totient](https://github.com/TheAlgorithms/Python/blob/master/maths/eulers_totient.py)
|
||||
* [Explicit Euler](https://github.com/TheAlgorithms/Python/blob/master/maths/explicit_euler.py)
|
||||
* [Extended Euclidean Algorithm](https://github.com/TheAlgorithms/Python/blob/master/maths/extended_euclidean_algorithm.py)
|
||||
* [Factorial Iterative](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_iterative.py)
|
||||
* [Factorial Python](https://github.com/TheAlgorithms/Python/blob/master/maths/factorial_python.py)
|
||||
|
@ -437,6 +442,7 @@
|
|||
* [Greatest Common Divisor](https://github.com/TheAlgorithms/Python/blob/master/maths/greatest_common_divisor.py)
|
||||
* [Greedy Coin Change](https://github.com/TheAlgorithms/Python/blob/master/maths/greedy_coin_change.py)
|
||||
* [Hardy Ramanujanalgo](https://github.com/TheAlgorithms/Python/blob/master/maths/hardy_ramanujanalgo.py)
|
||||
* [Integration By Simpson Approx](https://github.com/TheAlgorithms/Python/blob/master/maths/integration_by_simpson_approx.py)
|
||||
* [Is Square Free](https://github.com/TheAlgorithms/Python/blob/master/maths/is_square_free.py)
|
||||
* [Jaccard Similarity](https://github.com/TheAlgorithms/Python/blob/master/maths/jaccard_similarity.py)
|
||||
* [Kadanes](https://github.com/TheAlgorithms/Python/blob/master/maths/kadanes.py)
|
||||
|
@ -444,11 +450,14 @@
|
|||
* [Krishnamurthy Number](https://github.com/TheAlgorithms/Python/blob/master/maths/krishnamurthy_number.py)
|
||||
* [Kth Lexicographic Permutation](https://github.com/TheAlgorithms/Python/blob/master/maths/kth_lexicographic_permutation.py)
|
||||
* [Largest Of Very Large Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/largest_of_very_large_numbers.py)
|
||||
* [Largest Subarray Sum](https://github.com/TheAlgorithms/Python/blob/master/maths/largest_subarray_sum.py)
|
||||
* [Least Common Multiple](https://github.com/TheAlgorithms/Python/blob/master/maths/least_common_multiple.py)
|
||||
* [Line Length](https://github.com/TheAlgorithms/Python/blob/master/maths/line_length.py)
|
||||
* [Lucas Lehmer Primality Test](https://github.com/TheAlgorithms/Python/blob/master/maths/lucas_lehmer_primality_test.py)
|
||||
* [Lucas Series](https://github.com/TheAlgorithms/Python/blob/master/maths/lucas_series.py)
|
||||
* [Matrix Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/maths/matrix_exponentiation.py)
|
||||
* [Max Sum Sliding Window](https://github.com/TheAlgorithms/Python/blob/master/maths/max_sum_sliding_window.py)
|
||||
* [Median Of Two Arrays](https://github.com/TheAlgorithms/Python/blob/master/maths/median_of_two_arrays.py)
|
||||
* [Miller Rabin](https://github.com/TheAlgorithms/Python/blob/master/maths/miller_rabin.py)
|
||||
* [Mobius Function](https://github.com/TheAlgorithms/Python/blob/master/maths/mobius_function.py)
|
||||
* [Modular Exponential](https://github.com/TheAlgorithms/Python/blob/master/maths/modular_exponential.py)
|
||||
|
@ -467,6 +476,7 @@
|
|||
* [Prime Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py)
|
||||
* [Prime Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_numbers.py)
|
||||
* [Prime Sieve Eratosthenes](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_sieve_eratosthenes.py)
|
||||
* [Primelib](https://github.com/TheAlgorithms/Python/blob/master/maths/primelib.py)
|
||||
* [Pythagoras](https://github.com/TheAlgorithms/Python/blob/master/maths/pythagoras.py)
|
||||
* [Qr Decomposition](https://github.com/TheAlgorithms/Python/blob/master/maths/qr_decomposition.py)
|
||||
* [Quadratic Equations Complex Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/quadratic_equations_complex_numbers.py)
|
||||
|
@ -491,6 +501,9 @@
|
|||
* [Sum Of Geometric Progression](https://github.com/TheAlgorithms/Python/blob/master/maths/sum_of_geometric_progression.py)
|
||||
* [Test Prime Check](https://github.com/TheAlgorithms/Python/blob/master/maths/test_prime_check.py)
|
||||
* [Trapezoidal Rule](https://github.com/TheAlgorithms/Python/blob/master/maths/trapezoidal_rule.py)
|
||||
* [Triplet Sum](https://github.com/TheAlgorithms/Python/blob/master/maths/triplet_sum.py)
|
||||
* [Two Pointer](https://github.com/TheAlgorithms/Python/blob/master/maths/two_pointer.py)
|
||||
* [Two Sum](https://github.com/TheAlgorithms/Python/blob/master/maths/two_sum.py)
|
||||
* [Ugly Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/ugly_numbers.py)
|
||||
* [Volume](https://github.com/TheAlgorithms/Python/blob/master/maths/volume.py)
|
||||
* [Zellers Congruence](https://github.com/TheAlgorithms/Python/blob/master/maths/zellers_congruence.py)
|
||||
|
@ -520,42 +533,23 @@
|
|||
|
||||
## Other
|
||||
* [Activity Selection](https://github.com/TheAlgorithms/Python/blob/master/other/activity_selection.py)
|
||||
* [Anagrams](https://github.com/TheAlgorithms/Python/blob/master/other/anagrams.py)
|
||||
* [Autocomplete Using Trie](https://github.com/TheAlgorithms/Python/blob/master/other/autocomplete_using_trie.py)
|
||||
* [Binary Exponentiation](https://github.com/TheAlgorithms/Python/blob/master/other/binary_exponentiation.py)
|
||||
* [Binary Exponentiation 2](https://github.com/TheAlgorithms/Python/blob/master/other/binary_exponentiation_2.py)
|
||||
* [Davis–Putnam–Logemann–Loveland](https://github.com/TheAlgorithms/Python/blob/master/other/davis–putnam–logemann–loveland.py)
|
||||
* [Detecting English Programmatically](https://github.com/TheAlgorithms/Python/blob/master/other/detecting_english_programmatically.py)
|
||||
* [Dijkstra Bankers Algorithm](https://github.com/TheAlgorithms/Python/blob/master/other/dijkstra_bankers_algorithm.py)
|
||||
* [Doomsday](https://github.com/TheAlgorithms/Python/blob/master/other/doomsday.py)
|
||||
* [Euclidean Gcd](https://github.com/TheAlgorithms/Python/blob/master/other/euclidean_gcd.py)
|
||||
* [Fischer Yates Shuffle](https://github.com/TheAlgorithms/Python/blob/master/other/fischer_yates_shuffle.py)
|
||||
* [Frequency Finder](https://github.com/TheAlgorithms/Python/blob/master/other/frequency_finder.py)
|
||||
* [Game Of Life](https://github.com/TheAlgorithms/Python/blob/master/other/game_of_life.py)
|
||||
* [Gauss Easter](https://github.com/TheAlgorithms/Python/blob/master/other/gauss_easter.py)
|
||||
* [Graham Scan](https://github.com/TheAlgorithms/Python/blob/master/other/graham_scan.py)
|
||||
* [Greedy](https://github.com/TheAlgorithms/Python/blob/master/other/greedy.py)
|
||||
* [Integeration By Simpson Approx](https://github.com/TheAlgorithms/Python/blob/master/other/integeration_by_simpson_approx.py)
|
||||
* [Largest Subarray Sum](https://github.com/TheAlgorithms/Python/blob/master/other/largest_subarray_sum.py)
|
||||
* [Least Recently Used](https://github.com/TheAlgorithms/Python/blob/master/other/least_recently_used.py)
|
||||
* [Lfu Cache](https://github.com/TheAlgorithms/Python/blob/master/other/lfu_cache.py)
|
||||
* [Linear Congruential Generator](https://github.com/TheAlgorithms/Python/blob/master/other/linear_congruential_generator.py)
|
||||
* [Lru Cache](https://github.com/TheAlgorithms/Python/blob/master/other/lru_cache.py)
|
||||
* [Magicdiamondpattern](https://github.com/TheAlgorithms/Python/blob/master/other/magicdiamondpattern.py)
|
||||
* [Markov Chain](https://github.com/TheAlgorithms/Python/blob/master/other/markov_chain.py)
|
||||
* [Max Sum Sliding Window](https://github.com/TheAlgorithms/Python/blob/master/other/max_sum_sliding_window.py)
|
||||
* [Median Of Two Arrays](https://github.com/TheAlgorithms/Python/blob/master/other/median_of_two_arrays.py)
|
||||
* [Nested Brackets](https://github.com/TheAlgorithms/Python/blob/master/other/nested_brackets.py)
|
||||
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/other/palindrome.py)
|
||||
* [Password Generator](https://github.com/TheAlgorithms/Python/blob/master/other/password_generator.py)
|
||||
* [Primelib](https://github.com/TheAlgorithms/Python/blob/master/other/primelib.py)
|
||||
* [Scoring Algorithm](https://github.com/TheAlgorithms/Python/blob/master/other/scoring_algorithm.py)
|
||||
* [Sdes](https://github.com/TheAlgorithms/Python/blob/master/other/sdes.py)
|
||||
* [Tower Of Hanoi](https://github.com/TheAlgorithms/Python/blob/master/other/tower_of_hanoi.py)
|
||||
* [Triplet Sum](https://github.com/TheAlgorithms/Python/blob/master/other/triplet_sum.py)
|
||||
* [Two Pointer](https://github.com/TheAlgorithms/Python/blob/master/other/two_pointer.py)
|
||||
* [Two Sum](https://github.com/TheAlgorithms/Python/blob/master/other/two_sum.py)
|
||||
* [Word Patterns](https://github.com/TheAlgorithms/Python/blob/master/other/word_patterns.py)
|
||||
|
||||
## Project Euler
|
||||
* Problem 001
|
||||
|
@ -885,11 +879,15 @@
|
|||
|
||||
## Strings
|
||||
* [Aho Corasick](https://github.com/TheAlgorithms/Python/blob/master/strings/aho_corasick.py)
|
||||
* [Anagrams](https://github.com/TheAlgorithms/Python/blob/master/strings/anagrams.py)
|
||||
* [Autocomplete Using Trie](https://github.com/TheAlgorithms/Python/blob/master/strings/autocomplete_using_trie.py)
|
||||
* [Boyer Moore Search](https://github.com/TheAlgorithms/Python/blob/master/strings/boyer_moore_search.py)
|
||||
* [Can String Be Rearranged As Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/can_string_be_rearranged_as_palindrome.py)
|
||||
* [Capitalize](https://github.com/TheAlgorithms/Python/blob/master/strings/capitalize.py)
|
||||
* [Check Anagrams](https://github.com/TheAlgorithms/Python/blob/master/strings/check_anagrams.py)
|
||||
* [Check Pangram](https://github.com/TheAlgorithms/Python/blob/master/strings/check_pangram.py)
|
||||
* [Detecting English Programmatically](https://github.com/TheAlgorithms/Python/blob/master/strings/detecting_english_programmatically.py)
|
||||
* [Frequency Finder](https://github.com/TheAlgorithms/Python/blob/master/strings/frequency_finder.py)
|
||||
* [Is Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/is_palindrome.py)
|
||||
* [Jaro Winkler](https://github.com/TheAlgorithms/Python/blob/master/strings/jaro_winkler.py)
|
||||
* [Knuth Morris Pratt](https://github.com/TheAlgorithms/Python/blob/master/strings/knuth_morris_pratt.py)
|
||||
|
@ -898,6 +896,7 @@
|
|||
* [Manacher](https://github.com/TheAlgorithms/Python/blob/master/strings/manacher.py)
|
||||
* [Min Cost String Conversion](https://github.com/TheAlgorithms/Python/blob/master/strings/min_cost_string_conversion.py)
|
||||
* [Naive String Search](https://github.com/TheAlgorithms/Python/blob/master/strings/naive_string_search.py)
|
||||
* [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/palindrome.py)
|
||||
* [Prefix Function](https://github.com/TheAlgorithms/Python/blob/master/strings/prefix_function.py)
|
||||
* [Rabin Karp](https://github.com/TheAlgorithms/Python/blob/master/strings/rabin_karp.py)
|
||||
* [Remove Duplicate](https://github.com/TheAlgorithms/Python/blob/master/strings/remove_duplicate.py)
|
||||
|
@ -907,6 +906,7 @@
|
|||
* [Swap Case](https://github.com/TheAlgorithms/Python/blob/master/strings/swap_case.py)
|
||||
* [Upper](https://github.com/TheAlgorithms/Python/blob/master/strings/upper.py)
|
||||
* [Word Occurrence](https://github.com/TheAlgorithms/Python/blob/master/strings/word_occurrence.py)
|
||||
* [Word Patterns](https://github.com/TheAlgorithms/Python/blob/master/strings/word_patterns.py)
|
||||
* [Z Function](https://github.com/TheAlgorithms/Python/blob/master/strings/z_function.py)
|
||||
|
||||
## Traversals
|
||||
|
|
|
@ -26,7 +26,7 @@ def read_file_binary(file_path: str) -> str:
|
|||
|
||||
|
||||
def add_key_to_lexicon(
|
||||
lexicon: dict, curr_string: str, index: int, last_match_id: int
|
||||
lexicon: dict, curr_string: str, index: int, last_match_id: str
|
||||
) -> None:
|
||||
"""
|
||||
Adds new strings (curr_string + "0", curr_string + "1") to the lexicon
|
||||
|
|
|
@ -196,8 +196,8 @@ class TwoHiddenLayerNeuralNetwork:
|
|||
>>> output_val = numpy.array(([0], [1], [1]), dtype=float)
|
||||
>>> nn = TwoHiddenLayerNeuralNetwork(input_val, output_val)
|
||||
>>> nn.train(output_val, 1000, False)
|
||||
>>> nn.predict([0,1,0])
|
||||
1
|
||||
>>> nn.predict([0,1,0]) in (0, 1)
|
||||
True
|
||||
"""
|
||||
|
||||
# Input values for which the predictions are to be made.
|
||||
|
@ -260,8 +260,8 @@ def example() -> int:
|
|||
In this example the output is divided into 2 classes i.e. binary classification,
|
||||
the two classes are represented by '0' and '1'.
|
||||
|
||||
>>> example()
|
||||
1
|
||||
>>> example() in (0, 1)
|
||||
True
|
||||
"""
|
||||
# Input values.
|
||||
input = numpy.array(
|
||||
|
|
Loading…
Reference in New Issue
Block a user