All problems
Average Word Embeddings
Problem
A simple sentence embedding is the coordinatewise mean of its word vectors.
Given the list of word vectors, return the mean vector.
Hint
Average each coordinate across the words.
Test cases
case 1
in: [[[1,0],[0,1]]]
expected: [0.5,0.5]
case 2
in: [[[1,1]]]
expected: [1,1]
case 3
in: [[[2,4],[4,8],[3,6]]]
expected: [3,6]
Starter codePython
def average_word_embeddings(vectors):
# Your code here
pass3 test cases · run your code against them in the editor