Exercise:Vectorization

From Ufldl

Jump to: navigation, search
(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 suggestions 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, <tt>repmat</tt> (and/or <tt>bsxfun</tt>). A vectorized version of our code ran in under one minute on a fast computer (for learning 25 features from 10000 8x8 image patches).  
+
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.)

Revision as of 19:03, 29 April 2011

Personal tools