Exercise:Vectorization
From Ufldl
(→Step 1: Vectorize your Sparse Autoencoder Implementation) |
|||
Line 11: | Line 11: | ||
=== Step 1: Vectorize your Sparse Autoencoder Implementation === | === Step 1: Vectorize your Sparse Autoencoder Implementation === | ||
- | Using the | + | Using the ideas from [[Vectorization]] and [[Neural Network Vectorization]], vectorize your implementation of <tt>sparseAutoencoderCost.m</tt>. In our implementation, we were able to remove all for-loops with the use of matrix operations and <tt>repmat</tt>. (If you want to play with more advanced vectorization ideas, also type <tt>help bsxfun</tt>. The <tt>bsxfun</tt> function provides an alternative to <tt>repmat</tt> for some of the vectorization steps, but is not necessary for this exercise). A vectorized version of our sparse autoencoder code ran in under one minute on a fast computer (for learning 25 features from 10000 8x8 image patches). |
(Note that you do not need to vectorize the code in the other files.) | (Note that you do not need to vectorize the code in the other files.) |