CNN_sentence icon indicating copy to clipboard operation
CNN_sentence copied to clipboard

Why initialize W[0] with all 0s?

Open allenanie opened this issue 9 years ago • 4 comments

Hi, I'm just having some trouble understanding the process_data.py file, especially saving a special W[0] word and initialize idx_map starting at 1. What's the purpose of doing that?

allenanie avatar Nov 23 '15 21:11 allenanie

Because he needs to pad sentence with zero vectors. See this function: get_idx_from_sent

csong27 avatar Dec 04 '15 13:12 csong27

Why padding the beginning of all sentences with the same number of zeros (filter_h=5 in function get_idx_from_sent) ? and how this number is set ? I guess this is related to the maximum region size / height used ? Another question is why function 'get_idx_from_sent' adding 0 until a length of max_l + 2*pad is reached where pad = filter_h - 1 ? Why not until max_l + pad only ?

Imane0 avatar Jul 19 '17 12:07 Imane0

Each sentence has different number of words and thus the inputs to the CNN would have different sizes. Therefore, padding is needed to ensure all inputs have the same size.

csong27 avatar Jul 19 '17 18:07 csong27

I got that. I'm asking why extending the length of all sentences to max_l + 2*pad and not just to max_l ?

Imane0 avatar Jul 19 '17 18:07 Imane0