Skip to content

Instantly share code, notes, and snippets.

@LauraLangdon
Created August 10, 2021 05:00
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/4a75924ddc67bbe28b185976bc810ca9 to your computer and use it in GitHub Desktop.
Save LauraLangdon/4a75924ddc67bbe28b185976bc810ca9 to your computer and use it in GitHub Desktop.
def randomize_vectors(tweet_vectors):
"""
:param tweet_vectors:
:return: randomized_tweet_vectors: a Numpy array of tweet vectors that have
been randomly shuffled
"""
#Initialize randomized tweet vectors
randomized_tweet_vectors = np.zeros((tweet_vectors.shape[0], tweet_vectors.shape[1]), dtype=int)
for x in range(tweet_vectors.shape[0]):
for y in range(tweet_vectors.shape[1]):
randomized_tweet_vectors[x][y] = tweet_vectors[x][y]
np.random.shuffle(randomized_tweet_vectors)
return randomized_tweet_vectors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment