Skip to content

Euclidean Distance #28

@xxlin-haa

Description

@xxlin-haa

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

Metadata

Metadata

Labels

lectureQuestions and comments about lectures

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions