Skip to content

Create euclidean_distance.py #3350

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

Merged
merged 37 commits into from
Nov 27, 2020
Merged

Create euclidean_distance.py #3350

merged 37 commits into from
Nov 27, 2020

Conversation

andrewctam
Copy link
Contributor

@andrewctam andrewctam commented Oct 15, 2020

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • 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 have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@andrewctam andrewctam requested a review from Kush1101 as a code owner October 15, 2020 21:06
@TravisBuddy
Copy link

Travis tests have failed

Hey @ac-tam,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 22646fb0-0f2b-11eb-9bff-abeacd856cb9

Copy link
Contributor Author

@andrewctam andrewctam left a comment

Choose a reason for hiding this comment

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

Updated name and generalized

@andrewctam andrewctam changed the title Create distance_formula.py Create euclidean_distance.py Oct 16, 2020
@TravisBuddy
Copy link

Travis tests have failed

Hey @ac-tam,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 8f4e0860-0fc2-11eb-8acb-27a1e4e1eb88

@TravisBuddy
Copy link

Travis tests have failed

Hey @ac-tam,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 8f494d70-0fc2-11eb-8acb-27a1e4e1eb88

@TravisBuddy
Copy link

Travis tests have failed

Hey @ac-tam,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 8f535f90-0fc2-11eb-8acb-27a1e4e1eb88

@cozek
Copy link
Member

cozek commented Oct 17, 2020

Hi @ac-tam . You have made good progress. Just read the Travis error logs and make your code comply with the contribution guidelines.

Copy link
Contributor Author

@andrewctam andrewctam left a comment

Choose a reason for hiding this comment

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

Added suggestions

@cclauss
Copy link
Member

cclauss commented Oct 19, 2020

This is looking cool! Please add or delete the doctest for 2.8284271247461903 as suggested by @cozek. Let’s try to benchmark a numpy version of this algorithm against a non-numpy version. Please rename the current function to euclidean_distance_np() and create a new euclidean_distance() function that has the same function signature but does not use numpy. Then we can add a timeit benchmark to see the performance difference.

@ghost ghost added the awaiting reviews This PR is ready to be reviewed label Nov 27, 2020
@ghost ghost added require tests Tests [doctest/unittest/pytest] are required and removed awaiting reviews This PR is ready to be reviewed labels Nov 27, 2020
@ghost ghost added the tests are failing Do not merge until tests pass label Nov 27, 2020
@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed require tests Tests [doctest/unittest/pytest] are required tests are failing Do not merge until tests pass labels Nov 27, 2020


if __name__ == "__main__":
def benchmark() -> None:
Copy link
Member

Choose a reason for hiding this comment

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

I am sorry if I was not clear but I meant to remove the function and just keep the code.

@ghost ghost added tests are failing Do not merge until tests pass and removed awaiting reviews This PR is ready to be reviewed labels Nov 27, 2020
@ghost ghost added awaiting reviews This PR is ready to be reviewed and removed tests are failing Do not merge until tests pass labels Nov 27, 2020
@andrewctam andrewctam requested a review from cclauss November 27, 2020 05:00
Co-authored-by: Christian Clauss <[email protected]>
@andrewctam andrewctam requested a review from cclauss November 27, 2020 14:39
Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Nice work! Cool to see the benchmark.

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Nov 27, 2020
@cclauss cclauss merged commit 10427f8 into TheAlgorithms:master Nov 27, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
peRFectBeliever pushed a commit to peRFectBeliever/Python that referenced this pull request Apr 1, 2021
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

Co-authored-by: Christian Clauss <[email protected]>

Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants