Exercise:Self-Taught Learning
From Ufldl
(→Step Five: Classifying on the test set) |
|||
Line 24: | Line 24: | ||
''If you have not completed the exercises listed above, we strongly suggest you complete them first.'' | ''If you have not completed the exercises listed above, we strongly suggest you complete them first.'' | ||
- | ===Step | + | ===Step 1: Generate the input and test data sets=== |
Download and decompress <tt>[http://ufldl.stanford.edu/wiki/resources/stl_exercise.zip stl_exercise.zip]</tt>, which contains starter code for this exercise. Additionally, you will need to download the datasets from the MNIST Handwritten Digit Database for this project. | Download and decompress <tt>[http://ufldl.stanford.edu/wiki/resources/stl_exercise.zip stl_exercise.zip]</tt>, which contains starter code for this exercise. Additionally, you will need to download the datasets from the MNIST Handwritten Digit Database for this project. | ||
- | ===Step | + | ===Step 2: Train the sparse autoencoder=== |
Next, we will train the unlabeled dataset on the sparse autoencoder, using the same <tt>sparseAutoencoderCost.m</tt> function from the previous assignments. (Use the frameworks from previous assignments to ensure that your code is working and vectorized.) The training step should take less than 25 minutes (on a reasonably fast computer). When it is completed, a visualization of pen strokes should be displayed. | Next, we will train the unlabeled dataset on the sparse autoencoder, using the same <tt>sparseAutoencoderCost.m</tt> function from the previous assignments. (Use the frameworks from previous assignments to ensure that your code is working and vectorized.) The training step should take less than 25 minutes (on a reasonably fast computer). When it is completed, a visualization of pen strokes should be displayed. | ||
Line 36: | Line 36: | ||
The features learned by the sparse autoencoder should correspond to penstrokes. | The features learned by the sparse autoencoder should correspond to penstrokes. | ||
- | ===Step | + | ===Step 3: Extracting features=== |
After the sparse autoencoder is trained, we can use it to extract features from the handwritten digit images. | After the sparse autoencoder is trained, we can use it to extract features from the handwritten digit images. | ||
Line 44: | Line 44: | ||
After doing so, this step will use your modified function to convert the raw image data to feature unit activations. | After doing so, this step will use your modified function to convert the raw image data to feature unit activations. | ||
- | ===Step | + | ===Step 4: Training and testing the logistic regression model=== |
In this step, you should use your code from the softmax exercise (<tt>softmaxTrain.m</tt>) to train the softmax classifier using the training features (<tt>trainFeatures</tt>) and labels (<tt>trainLabels</tt>). | In this step, you should use your code from the softmax exercise (<tt>softmaxTrain.m</tt>) to train the softmax classifier using the training features (<tt>trainFeatures</tt>) and labels (<tt>trainLabels</tt>). | ||
- | ===Step | + | ===Step 5: Classifying on the test set=== |
Finally, complete the code to make predictions on the test set (<tt>testFeatures</tt>) and see how your learned features perform! If you've done all the steps correctly, you should get an accuracy of about '''98%''' percent. | Finally, complete the code to make predictions on the test set (<tt>testFeatures</tt>) and see how your learned features perform! If you've done all the steps correctly, you should get an accuracy of about '''98%''' percent. | ||
[[Category:Exercises]] | [[Category:Exercises]] |