Machine-Learning

Exercise and Project Responses

View project on GitHub

1. In Laurence Maroney’s video, What is ML, he compares traditional programming with machine learning and argues that the main difference between the two is a reorientation of the rules, data and answers. According to Maroney, what is the difference between traditional programming and machine learning?

  • In traditional programming, programmers use rules and data to produce answers. However, machine learning almost reverses this process, as the programmer must know what answer they’re looking to receive and provide the data necessary to reach this answer. Then, the machine/computer will generate the rules necessary to reach that answer. In short, traditional programming yields answers based on rules and data, while machine learning yields rules based on answers and data.

2. With the first basic script that Maroney used to predict a value output from the model he estimated (he initially started with 10 that predicted ~31. Modify the predict function to produce the output for the value 7. Do this twice and provide both answers. Are they the same? Are they different? Why is this so?

  • For the first prediction, the output was 21.99994. The loss on the final epoch (i.e., 500/500) was 1.3511e-09. For the second prediction, the output was 21.999409. The loss on the final epoch for this second prediction was 1.2854e-07. While the predictions were extremely close at approximately 30, they were still slightly different. In addition, while the losses were both extremely small, the loss was 100X larger for the second prediction. These differ because neural networks base their predictions on the probability that the model and its paramters are correct. Although the model of Y = 3X + 1 is very strong, there is still a very slight possibility that the model is not correct because there are so few datapoints available to train the model. Consequently, the machine may not predict the exact answer of 30 when the input is 7, 100% of the time.

3. Using the script you produced to predict housing price, take the provided six houses and train a neural net model that estimates the relationship between them. Based on this model, which of the six homes present a good deal? Which one is the worst deal? Justify your answer.

  • I used a neural network consisting of one neuron in one layer to predict the housing prices for each room size (i.e., 2, 3, 4, 5). I then subtracted the price of each house from the model’s prediction for houses with the same number of rooms to determine how much more or less expensive the house is than predicted. The overvalued houses were the Church and Moon houses, which cost approximately $99,193 and $80,674 more than predicted for houses with the same number of rooms, respectively. The Church house had four rooms and the Moon house had two rooms. The undervalued houses were the Hudgins, Mathews, Mobjack, and New Point Comfort Houses. These cost approximately $137,567, $17,547, $10,807, and $5,567 less than predicted for houses with the same number of rooms, respectively. Both Hudgins and New Point Comfort had three rooms, Mathews had five rooms, and Mobjack had four rooms.

    As a result, I determined that the Hudgins house has the best value, at a price of $97,000, because it costs approximately $137,567 less than houses with three bedrooms are predicted to cost. The Hudgins house is thus the most undervalued. On the other hand, the Church house has the worst value, at a price of $399,000, because it costs approximately $99,193 more than houses with four bedroom are predicted to cost. The Church house is thus the most overvalued.