data-310

A repository for posting assignments, code, and informal responses for Professor Frazier's DATA 310 course, Applied Machine Learning.

View the Project on GitHub amartrics/data-310

Week One, Day Two: Wednesday (7/8/2021)

Start with the Basic classification: Classify images of clothing script that you prepared for class. Consider the following questions as you execute the code.

  1. From the Preprocess the data section of the script, modify the training image to produce three new images. image

  2. Under the Make predictions section, present the array of predictions for an image from the test set other than the one given in the example script. array([1.2335849e-02, 1.4078130e-02, 8.3997244e-01, 5.3022159e-06, 1.2764661e-01, 4.0197827e-07, 5.8050752e-03, 1.2845909e-06, 1.5286525e-04, 2.0806949e-06], dtype=float32)

    a) What does this array represent? This array represents the model’s confidence in its classification of an image within the 10 different categories available in the Fashion MNIST database.

    b) How were the Softmax() and argmax() functions applied? The Softmax() function adds a Softmax layer to the model that converts the original output of logits into a more interpretable format of decimal probabilities. The argmax() function produces the greatest probability in a given list or array.

    c) Does the output from np.argmax() match the label from your test_labels dataset? Yes, the output from np.argmax() matches the label from the test_labels dataset for the image I tested (image 20), which is a pullover.

  3. Under the Verify predictions section, plot two additional images (other than either of the two given in the example script) and include the graph of their predicted label as well as the image itself.

image

image

  1. Under the Use the trained model section, again select a new image from the test dataset. Produce the predictions for this newly selected image.

    image

    a) Does the predicted value match the test label? The model thinks the predicted value is almost 100% a shirt/top in this situation. In reality (aka the test label), it is a shirt/top, so it seems that the two values match pretty well.

    b) Although you applied the argmax() function in this second instance, you did not use Softmax() a second time. Why is that so (please be specific)? In this instance, it was desirable to produce only a single predicted value (generated by argmax) rather than a probability (generated by Softmax).

Switch the dataset from sets of clothing to hand written numbers.

  1. Produce a plot of 25 handwritten numbers from the data with their labels indicated below each image.

image

  1. Fit the model and report the accuracy of the training dataset. Likewise report the accuracy of the test dataset. The training accuracy of the model was about 0.9595, or 95% accurate. The testing accuracy of the model was similarly high, about 0.9455 or 94%.

  2. As in the above example, plot two images and include the graph of their predicted label as well as the image itself.

image

image

  1. Evaluate how your model for the MNIST dataset compared with your model of the Fashion_MNIST dataset. Which of the two models is more accurate? Why do you think this is so? It seems that the MNIST (handwritten numbers) model is more accurate than the Fashion_MNIST model. The former has training and testing accuracies of 95% and 94% respectively, while the latter has training and testing accuracies of 90% and 87%. It is understandable that the model predicting types of clothing is less accurate, since the images in the dataset being analyzed are more complex in nature (more room for error in identifying what each pixel means) in contrast to the simpler handwritten numbers.