Skip to content

Upgraded 3 files , Fixed and optimised capitalize.py , check_anagrams.py , back_propagation_neural_network.py #11596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

Soyvor
Copy link

@Soyvor Soyvor commented Sep 30, 2024

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation 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. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • 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.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

Soyvor added 3 commits October 1, 2024 03:17
Consistent naming conventions: The code uses both camelCase and underscore notation for variable names. To maintain consistency, I've used underscore notation throughout the code.
Type hints and docstrings: Added type hints and docstrings to improve code readability and understandability.
Simplified layer initialization: Simplified the layer initialization process by removing unnecessary variables and using more concise code.
Improved forward and backward propagation: Simplified the forward and backward propagation processes by reducing the number of intermediate variables and using more efficient matrix operations.
Removed unnecessary variables: Removed unnecessary variables and computations to improve code efficiency.
Improved plotting: Improved the plotting function to use more efficient and concise code.
Fixed the signature function to remove spaces and convert to lowercase before sorting the word.
Extracted the word list loading into a separate function load_word_list.
Extracted the creation of the word_by_signature dictionary into a separate function create_word_by_signature.
Extracted the finding of all anagrams into a separate function find_all_anagrams.
Created a main function to encapsulate the main logic of the program.
Improved the naming of variables and functions to make the code more readable.
Removed the if __name__ == "__main__": block from the original code and replaced it with a main function.
Added a check to see if the first character of the sentence is a letter using the isalpha() method. This prevents the function from trying to capitalize non-letter characters.
Added a comment to explain the purpose of the lower_to_upper dictionary.
Added a comment to explain the logic behind capitalizing the first character of the sentence.
Added a comment to explain the purpose of the return statement when the first character is not a letter.
Improved the docstring to include more examples and to make it clearer what the function does.
@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Sep 30, 2024
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Sep 30, 2024
@tianyizheng02 tianyizheng02 changed the title Upgraded 3 files , Fixed and optimised capitalize.py , check_anagrams.py , back_propagation_neural_network.py. please label me for HacktoberFest Accepted Upgraded 3 files , Fixed and optimised capitalize.py , check_anagrams.py , back_propagation_neural_network.py Oct 1, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? This completely removes the existing implementation. The whole point is that we implement the algorithm from scratch, without using the built-in function, so that people can see how the algorithm works. Please read our contributing guidelines.

@tianyizheng02
Copy link
Contributor

As stated in the PR description,

This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.

Please help us out during Hacktoberfest by opening separate PRs for separate algorithms, rather than opening a single PR for edits in three separate algorithm files. This speeds up the review process by making it easier to review your code. Furthermore, in the case of this PR, there are some changes that appear to be potentially helpful, while others shouldn't be merged.

@tianyizheng02 tianyizheng02 added the multiple algorithms not allowed Multiple algorithms in a single PR are not allowed label Oct 1, 2024
@tianyizheng02
Copy link
Contributor

Also, please do not ask to have your PR approved for Hacktoberfest in your PR title. It makes your title much harder to read, and it's strange to ask for a Hacktoberfest approval before anyone has verified that your PR should be merged.

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 multiple algorithms not allowed Multiple algorithms in a single PR are not allowed tests are failing Do not merge until tests pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants