Neural Network Vectorization
From Ufldl
(→Sparse autoencoder) |
|||
Line 139: | Line 139: | ||
Notice that the sparsity_delta is the same regardless of the example we are processing. | Notice that the sparsity_delta is the same regardless of the example we are processing. | ||
- | Recall that when we vectorizing the gradient computations, <tt>delta2</tt> is replaced with matrices. Thus, to vectorize the <tt>sparsity_delta</tt> | + | Recall that when we vectorizing the gradient computations, <tt>delta2</tt> is replaced with matrices. Thus, to vectorize the above computations, we can simply add <tt>sparsity_delta</tt> (using <tt>repmat</tt>) while computing the <tt>delta2</tt> matrices. |