title: Convert a text into a vector to make predictions using Tensorflow's wiki-words-250 which uses a Word2Vec Skip-Gram architecture
body: <p>Objective: creation of an LSTM model to make predictions based on text data (political and economic news of the United States), in order to classify them as true or false).</p>
  <p>I found an error in the previous step, that is in converting the text into vector format in order to be processed by the computer; I am using wiki-words-250 from Tensorflow which uses a Word2Vec Skip-Gram architecture.</p>
  <pre><code>import tensorflow_hub as hub
  import tensorflow as tf
  
  embed = hub.load(&quot;https://tfhub.dev/google/Wiki-words-250/2&quot;)
  </code></pre>
  <p>#Convert each series of words to a word2vec embedding</p>
  <pre><code>indiv = []
  for i in title_train:
    temp = np.array(embed(i))
   
    indiv.append(temp)
  </code></pre>
  <p>#Accounts for different length of words</p>
  <pre><code>indiv = tf.keras.preprocessing.sequence.pad_sequences(indiv,dtype='float')
  indiv.shape
  </code></pre>
  <p>I encounter this error on the line:</p>
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-26-9925d8ccea7b&gt; in &lt;module&gt;()
        8 indiv = []
        9 for i in news_train:
  ---&gt; 10   temp = np.array(embed(i))
       11 
       12   indiv.append(temp)
  
  2 frames
  /usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/function.py in _convert_inputs_to_signature(inputs, input_signature, flat_input_signature)
     2852       flat_input_signature,
     2853       flatten_inputs)):
  -&gt; 2854     raise ValueError(&quot;Python inputs incompatible with input_signature:\n&quot;
     2855                      f&quot;{format_error_message(inputs, input_signature)}.&quot;)
     2856 
  
  ValueError: Python inputs incompatible with input_signature:
    inputs: (
      news)
    input_signature: (
      TensorSpec(shape=(None,), dtype=tf.string, name=None)).
  </code></pre>