sample test label transformationactual labels['negative'positive'negative'encoded labels[ one hot encoded labels[ ]thuswe can see from the preceding sample outputs how our sentiment class labels have been encoded into numeric representationswhich in turn have been converted into one-hot encoded vectors the feature engineering techniques we will be using in this section (step are slightly more advanced word vectorization techniques that are based on the concept of word embeddings we will be using the word vec and glove models to generate embeddings the word vec model was built by google and we have covered this in detail in under the section "word embeddingswe will be choosing the size parameter to be in this scenario representing feature vector size to be for each word in [ ]build word vec model v_num_features  v_model gensim models word vec(tokenized_trainsize= v_num_featureswindow= min_count= sample= - we will be using the document word vector averaging scheme on this model from to represent each movie review as an averaged vector of all the word vector representations for the different words in the review the following function helps us compute averaged word vector representations for any corpus of text documents def averaged_word vec_vectorizer(corpusmodelnum_features)vocabulary set(model wv index worddef average_word_vectors(wordsmodelvocabularynum_features)feature_vector np zeros((num_features,)dtype="float "nwords for word in wordsif word in vocabularynwords nwords feature_vector np add(feature_vectormodel[word]if nwordsfeature_vector np divide(feature_vectornwordsreturn feature_vector features [average_word_vectors(tokenized_sentencemodelvocabularynum_featuresfor tokenized_sentence in corpusreturn np array(featureswe can now use the previous function to generate averaged word vector representations on our two movie review datasets