Skip to content

Instantly share code, notes, and snippets.

@LauraLangdon
Created August 10, 2021 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LauraLangdon/3844439fc0151be27dda160801a3ec20 to your computer and use it in GitHub Desktop.
Save LauraLangdon/3844439fc0151be27dda160801a3ec20 to your computer and use it in GitHub Desktop.
def get_distance(tweet1_vector, tweet2_vector) -> int:
"""
Implement Minkowski distance metric
:param tweet1_vector: vector of first tweet
:param tweet2_vector: vector of second tweet
:return: Minkowski distance between tweets
"""
distance = 0
for x in range(tweet1_vector.shape[0] - 2):
distance = distance + abs(tweet1_vector[x] - tweet2_vector[x])
return distance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment