Menu

Force zeros in the AffineComponentPreconditioned

Morino
2015-07-09
2015-07-14
  • Morino

    Morino - 2015-07-09

    Hi,

    usually each neural net (NN) layer has a fully connecting weight matrix. However, I like to force some weights (just in the first NN-layer) to be zero. Is there any way in Kaldi to initialize specific weights with zeros and to avoid learning of them? Maybe the BlockAffineComponentPreconditioned can do the job if I arrange my input features to blocks that should be connected? (or maybe I have a wrong idea about the BlockAffineComponent!?)

    Best,
    niko

     

    Last edit: Morino 2015-07-09
    • Daniel Povey

      Daniel Povey - 2015-07-09

      Yes, if you want a block structure then
      BlockAffineComponentPreconditioned would probably work.
      Personally, I have not had much success with methods of this type.
      Dan

      On Thu, Jul 9, 2015 at 7:17 AM, Morino mozno@users.sf.net wrote:

      Hi,

      usually each neural net (NN) layer has fully connected weights. However, I
      like to force some weights in the first NN-layer to be zero. I.e., is there
      any way in Kaldi that specific weights are not learned and initialized with
      zeros? Maybe the BlockAffineComponentPreconditioned can solve my problem by
      building blocks in the features? (or maybe I have a wrong idea about the
      BlockAffineComponent!?)

      Best,
      niko


      Force zeros in the AffineComponentPreconditioned


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/kaldi/discussion/1355347/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Morino

    Morino - 2015-07-09

    A better ASR score is not my primary goal here. I just like to investigate learned weights to get more insight on what information a NN extracts. Thereto I try to force the net to extract specific cues separately, so that the result will be more easy to interpret.
    However, I can see two parameters in the nnet2/train_block.sh script that supposedly control the blocks, i.e., block_size and block_shift. For my understanding: Can these two parameters be understood similar to a block processing known from the STFT, for example (with the feature vector being the signal)? What if the last coefficients of a feature vector doesn't fit into an entire block_size anymore? (Does it repeat some features or reduces the size of the last block?)

    Sorry for that many questions and thank you for your feedback. :)
    Niko

     
    • Daniel Povey

      Daniel Povey - 2015-07-09

      Sorry I don't recall the exact meaning and don't have time to check,
      you'll have to look at the code.
      However if you think you'll be able to see something interesting in
      the weights, I think you may be disappointed.
      Dan

      On Thu, Jul 9, 2015 at 10:08 AM, Morino mozno@users.sf.net wrote:

      A better ASR score is not my primary goal here. I just like to investigate
      learned weights to get more insight on what information a NN extracts.
      Thereto I try to force the net to extract specific cues separately, so that
      the result will be more easy to interpret.
      However, I can see two parameters in the nnet2/train_block.sh script that
      supposedly control the blocks, i.e., block_size and block_shift. For my
      understanding: Can these two parameters be understood similar to a block
      processing known from the STFT, for example (with the feature vector being
      the signal)? What if the last coefficients of a feature vector doesn't fit
      into an entire block_size anymore? (Does it repeat some features or reduces
      the size of the last block?)

      Sorry for that many questions and thank you for your feedback. :)
      Niko


      Force zeros in the AffineComponentPreconditioned


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/kaldi/discussion/1355347/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Morino

    Morino - 2015-07-09

    Ok, I looked to the code and found it. It is as I assumed and if the last block doesn't fit, it is just shifted so that it will.
    Thanks again and best,
    niko

     
  • Morino

    Morino - 2015-07-14

    Hi Dan,

    I found a small bug in the steps/nnet2/get_lda_block.sh script. Here is a bug fix:

    $ diff steps/nnet2/get_lda_block_old.sh steps/nnet2/get_lda_block.sh
    97a98
    > doonce=0
    99c100
    < while [ $[$cur_index+$block_size] -lt $feat_dim ]; do
    ---
    > while [ $[$cur_index+$block_size] -le $feat_dim ] && [ $doonce -le 1 ]; do
    106c107
    <   if [ $[$cur_index+$block_size] -gt $feat_dim ]; then
    ---
    >   if [ $[$cur_index+$block_size] -ge $feat_dim ]; then
    107a109
    >     doonce=$[$doonce+1]
    

    The old version may miss the last block with the consequence that higher indexes of a feature vector will be unused.

    Best,
    niko

     

    Last edit: Morino 2015-07-14
    • Daniel Povey

      Daniel Povey - 2015-07-14

      Thanks, committing the fix.
      Dan

      On Tue, Jul 14, 2015 at 5:35 AM, Morino mozno@users.sf.net wrote:

      Hi Dan,

      I found a small bug in the steps/nnet2/get_lda_block.sh script. Here is a
      bug fix:

      $diff steps/nnet2/get_lda_block_old.sh steps/nnet2/get_lda_block.sh
      99c99
      < while [ $[$cur_index+$block_size] -lt $feat_dim ]; do


      while [ $[$cur_index+$block_size] -le $feat_dim ]; do
      106c106
      < if [ $[$cur_index+$block_size] -gt $feat_dim ]; then


      if [ $[$cur_index+$block_sizei-1] -gt $feat_dim ]; then

      The old version may miss the last block with the consequence that higher
      indexes of a feature vector will be unused.

      Best,
      niko


      Force zeros in the AffineComponentPreconditioned


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/kaldi/discussion/1355347/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/