Answers.Body: <p>I would highly recommend modeling things differently with regard to how letters are presented to the model. While the problem is more natural, perhaps, for a Convolutional or Recurrent Neural Network, there's no problem to try and run this on a feed forward network. However, the way you give letters as input will be very confusing for a network and will make learning very hard. I'd recommend using one hot encoding or even a binary encoding for the letters. If this is for more than playing around I'd try and add some info (encode whether the letter is in "aeiou" in a separate bit).</p>
  
  <p>As for the hidden layers, try playing around a bit. Two systematic approaches are to start very simple and make the model more complicated, or start complicated and make your model simpler (or just normalize a lot). Look at the performance on the training set and on a separate validation set during training. If the model keeps on improving on the training data but starts to deteriorate on the validation data, you're probably over fitting. In this case you should either make the model simpler (fewer nodes, fewer layers) or regularize (start with l2 normalization on the weights). If the data doesn't perform well on the training data, you may wish to make the model more complex.</p>
  
  <p>Once you've tried the feedforward network, really do try CNN or RNNs for this task.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-02T13:31:52.200Z
Answers.LastActivityDate: 2017-01-02T13:31:52.200Z
Answers.UserDisplayName: Gilad Tsur
Body: <p>I am going to design a neural network which will be able to break a 5-letter word into its corresponding syllables (hybrid syllables, I mean it will not strictly adhere to grammatical syllable rules but will be based on some training sets I provide).</p>
  <p>Example: <code>&quot;train&quot; -&gt; &quot;tra&quot;-&quot;in&quot;</code>.</p>
  <p>I think of implementing it in terms of some feedforward neural network with 1 input layer, 1 hidden layer and 1 output layer.</p>
  <p>There will be 5 input nodes in the form of decimals (<code>1/26 = 0.038</code> for <code>'A'</code> ; <code>2/26 = 0.076</code> for <code>'B'</code>, etc.)</p>
  <p>The output layer consists of 4 nodes, which corresponds to each gap between two characters in the word.</p>
  <p>And fires as follows:</p>
  <ul>
  <li><p>For <code>&quot;train&quot;</code> (<code>&quot;tra&quot;-&quot;in&quot;</code>), the input is <code>(0.769, 0.692, 0.038, 0.346, 0.538)</code> and the output would be <code>(0, 0, 1, 0)</code>.</p>
  </li>
  <li><p>For <code>&quot;boric&quot;</code> (<code>&quot;bo&quot;-&quot;ri&quot;-&quot;c&quot;</code>), the input is something else, and the output is <code>(0, 1, 0, 1)</code>.</p>
  </li>
  </ul>
  <p>Is it possible to implement the neural network in the way I am doing? If possible, then how will I decide the number of hidden layers and nodes in each layer?</p>
  <p>In the book I am reading, the XOR gate problem and its implementation using hidden layer is given. In XOR, we could decide the number of nodes and hidden layers required by seeing the linear separability of XOR using two lines. But here I think such analysis can't be made..</p>
  <p>So, how do I proceed? Or is it a trial and error process?</p>
  
Tags: <neural-networks><hyperparameter-optimization><hyper-parameters><feedforward-neural-networks><network-design>
Title: How do I design a neural network that breaks a 5-letter word into its corresponding syllables?
UserDisplayName: Programmer
ThreadText: # How do I design a neural network that breaks a 5-letter word into its corresponding syllables?
  
  (Asked by: username_0 on 2016-12-31)
  
  I am going to design a neural network which will be able to break a 5-letter word into its corresponding syllables (hybrid syllables, I mean it will not strictly adhere to grammatical syllable rules but will be based on some training sets I provide).
  
  Example: `"train" -> "tra"-"in"`.
  
  I think of implementing it in terms of some feedforward neural network with 1 input layer, 1 hidden layer and 1 output layer.
  
  There will be 5 input nodes in the form of decimals (`1/26 = 0.038` for `'A'` ; `2/26 = 0.076` for `'B'`, etc.)
  
  The output layer consists of 4 nodes, which corresponds to each gap between two characters in the word.
  
  And fires as follows:
  
  * For `"train"` (`"tra"-"in"`), the input is `(0.769, 0.692, 0.038, 0.346, 0.538)` and the output would be `(0, 0, 1, 0)`.
  * For `"boric"` (`"bo"-"ri"-"c"`), the input is something else, and the output is `(0, 1, 0, 1)`.
  
  Is it possible to implement the neural network in the way I am doing? If possible, then how will I decide the number of hidden layers and nodes in each layer?
  
  In the book I am reading, the XOR gate problem and its implementation using hidden layer is given. In XOR, we could decide the number of nodes and hidden layers required by seeing the linear separability of XOR using two lines. But here I think such analysis can't be made..
  
  So, how do I proceed? Or is it a trial and error process?
  
  **Tags:** neural-networks, hyperparameter-optimization, hyper-parameters, feedforward-neural-networks, network-design
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-01-02. Score: 3 | Accepted answer
  
  I would highly recommend modeling things differently with regard to how letters are presented to the model. While the problem is more natural, perhaps, for a Convolutional or Recurrent Neural Network, there's no problem to try and run this on a feed forward network. However, the way you give letters as input will be very confusing for a network and will make learning very hard. I'd recommend using one hot encoding or even a binary encoding for the letters. If this is for more than playing around I'd try and add some info (encode whether the letter is in "aeiou" in a separate bit).
  
  As for the hidden layers, try playing around a bit. Two systematic approaches are to start very simple and make the model more complicated, or start complicated and make your model simpler (or just normalize a lot). Look at the performance on the training set and on a separate validation set during training. If the model keeps on improving on the training data but starts to deteriorate on the validation data, you're probably over fitting. In this case you should either make the model simpler (fewer nodes, fewer layers) or regularize (start with l2 normalization on the weights). If the data doesn't perform well on the training data, you may wish to make the model more complex.
  
  Once you've tried the feedforward network, really do try CNN or RNNs for this task.
  
  
  ---
  
  