title: How does Keras 1d convolution layer work with word embeddings - text classification problem? (Filters, kernel size, and all hyperparameter)
body: <p>I am currently developing a text classification tool using Keras. It works (it works fine and I got up to 98.7 validation accuracy) but I can't wrap my head around about how exactly 1D-convolution layer works with text data.</p>
  
  <p>What hyper-parameters should I use?</p>
  
  <p>I have the following sentences (input data):</p>
  
  <ul>
  <li>Maximum words in the sentence: 951 (if it's less - the paddings are added)</li>
  <li>Vocabulary size: ~32000</li>
  <li>Amount of sentences (for training): 9800</li>
  <li>embedding_vecor_length: 32 (how many relations each word has in word embeddings)</li>
  <li>batch_size: 37 (it doesn't matter for this question)</li>
  <li>Number of labels (classes): 4</li>
  </ul>
  
  <p>It's a very simple model (I have made more complicated structures but, strangely it works better - even without using LSTM):</p>
  
  <pre><code>model = Sequential()
  model.add(Embedding(top_words, embedding_vecor_length, input_length=max_review_length))
  model.add(Conv1D(filters=32, kernel_size=2, padding='same', activation='relu'))
  model.add(MaxPooling1D(pool_size=2))
  model.add(Flatten())
  model.add(Dense(labels_count, activation='softmax'))
  model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
  print(model.summary())
  </code></pre>
  
  <p>My main question is: What hyper-parameters should I use for Conv1D layer?</p>
  
  <pre><code>model.add(Conv1D(filters=32, kernel_size=2, padding='same', activation='relu'))
  </code></pre>
  
  <p>If I have following input data:</p>
  
  <ul>
  <li>Max word count: 951</li>
  <li>Word-embeddings dimension: 32 </li>
  </ul>
  
  <p>Does it mean that <code>filters=32</code> will only scan first 32 words completely discarding the rest (with <code>kernel_size=2</code>)? And I should set filters to 951 (max amount of words in the sentence)?</p>
  
  <p>Examples on images:</p>
  
  <p>So for instance this is an input data: <a href="http://joxi.ru/krDGDBBiEByPJA" rel="noreferrer">http://joxi.ru/krDGDBBiEByPJA</a></p>
  
  <p>It's the first step of a convoulution layer (stride 2): <a href="http://joxi.ru/Y2LB099C9dWkOr" rel="noreferrer">http://joxi.ru/Y2LB099C9dWkOr</a></p>
  
  <p>It's the second step (stride 2): <a href="http://joxi.ru/brRG699iJ3Ra1m" rel="noreferrer">http://joxi.ru/brRG699iJ3Ra1m</a></p>
  
  <p>And if <code>filters = 32</code>, layer repeats it 32 times? Am I correct?
  So I won't get to say 156-th word in the sentence, and thus this information will be lost?</p>