Skip to content
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

Euclidean Distance #28

Open
xxlin-haa opened this issue Feb 7, 2022 · 0 comments
Open

Euclidean Distance #28

xxlin-haa opened this issue Feb 7, 2022 · 0 comments
Assignees
Labels
lecture Questions and comments about lectures

Comments

@xxlin-haa
Copy link

For 02/03 lecture, I'm not sure why we need to have this second line in euclidean function? Thank you.

def euclidean(x1: Dict[str, float], x2: Dict[str, float]) -> float:
t = sum(((s1 - x2.get(term, 0)) ** 2 for term, s1 in x1.items()))
t += sum((s2 ** 2 for term, s2 in x2.items() if term not in x1))
return t

@xxlin-haa xxlin-haa added the lecture Questions and comments about lectures label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lecture Questions and comments about lectures
Projects
None yet
Development

No branches or pull requests

4 participants