You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: