2.9 Practical Tips for Linear Regression | Feature engineering --[Machine Learning | Andrew Ng]
 The choice of features can have a huge impact on your learning algorithm's performance. In fact, for many practical applications, choosing or entering the right features is a critical step to making the algorithm work well. In this video, let's take a look at how you can choose or engineer the most appropriate features for your learning algorithm. Let's take a look at feature engineering by revisiting the example of predicting the price of a house. Say you have two features for each house. X1 is the width of the lot size of the plot of land that the house is built on. This in real estate is also called the frontage of the lot. And the second feature, X2, is the depth of the lot size of, let's assume, the rectangular plot of land that the house was built on. Given these two features, X1 and X2, you might build a model like this, where f of x is w1 x1 plus w2 x2 plus b, where x1 is the frontage or width and x2 is the depth. And this model might work okay. But here's another option for how you might choose a different way to use these features in the model that could be even more effective. You might notice that the area of the land can be calculated as the frontage or width times the depth. And you may have an intuition that the area of the land is more predictive of the price than the frontage and depth as separate features. So you might define a new feature, X3, as X1 times X2. So this new feature X3 is equal to the area of the plot of land. For this feature, you can then have a model fwb of x equals w1 x1 plus w2 x2 plus w3 x3 plus b, so that the model can now choose parameters w1, w2, and w3, depending on whether the data shows that the frontage or the depth or the area x3 of the lot turns out to be the most important thing for predicting the price of the house. What we just did, creating a new feature, is an example of what's called feature engineering, in which you might use your knowledge or intuition about the problem to design new features, usually by transforming or combining the original features of the problem in order to make it easier for the learning algorithm to make accurate predictions. So depending on what insights you may have into the application, rather than just taking the features that you happen to have started off with, sometimes by defining new features, you might be able to get a much better model. So that's feature engineering. And it turns out that there's one flavor of feature engineering that will allow you to fit not just straight lines, but curves, nonlinear functions to your data. Let's take a look in the next video at how you can do that.
[{"start": 0.0, "end": 6.0, "text": " The choice of features can have a huge impact on your learning algorithm's performance."}, {"start": 6.0, "end": 11.120000000000001, "text": " In fact, for many practical applications, choosing or entering the right features is"}, {"start": 11.120000000000001, "end": 14.6, "text": " a critical step to making the algorithm work well."}, {"start": 14.6, "end": 18.76, "text": " In this video, let's take a look at how you can choose or engineer the most appropriate"}, {"start": 18.76, "end": 21.76, "text": " features for your learning algorithm."}, {"start": 21.76, "end": 26.560000000000002, "text": " Let's take a look at feature engineering by revisiting the example of predicting the price"}, {"start": 26.560000000000002, "end": 28.72, "text": " of a house."}, {"start": 28.72, "end": 31.599999999999998, "text": " Say you have two features for each house."}, {"start": 31.599999999999998, "end": 37.78, "text": " X1 is the width of the lot size of the plot of land that the house is built on."}, {"start": 37.78, "end": 42.8, "text": " This in real estate is also called the frontage of the lot."}, {"start": 42.8, "end": 49.04, "text": " And the second feature, X2, is the depth of the lot size of, let's assume, the rectangular"}, {"start": 49.04, "end": 52.120000000000005, "text": " plot of land that the house was built on."}, {"start": 52.120000000000005, "end": 58.68, "text": " Given these two features, X1 and X2, you might build a model like this, where f of x is w1"}, {"start": 58.68, "end": 68.32, "text": " x1 plus w2 x2 plus b, where x1 is the frontage or width and x2 is the depth."}, {"start": 68.32, "end": 70.6, "text": " And this model might work okay."}, {"start": 70.6, "end": 74.62, "text": " But here's another option for how you might choose a different way to use these features"}, {"start": 74.62, "end": 77.42, "text": " in the model that could be even more effective."}, {"start": 77.42, "end": 82.68, "text": " You might notice that the area of the land can be calculated as the frontage or width"}, {"start": 82.68, "end": 84.72, "text": " times the depth."}, {"start": 84.72, "end": 90.44, "text": " And you may have an intuition that the area of the land is more predictive of the price"}, {"start": 90.44, "end": 94.28, "text": " than the frontage and depth as separate features."}, {"start": 94.28, "end": 100.02, "text": " So you might define a new feature, X3, as X1 times X2."}, {"start": 100.02, "end": 105.6, "text": " So this new feature X3 is equal to the area of the plot of land."}, {"start": 105.6, "end": 115.24, "text": " For this feature, you can then have a model fwb of x equals w1 x1 plus w2 x2 plus w3 x3"}, {"start": 115.24, "end": 122.88, "text": " plus b, so that the model can now choose parameters w1, w2, and w3, depending on whether the data"}, {"start": 122.88, "end": 129.16, "text": " shows that the frontage or the depth or the area x3 of the lot turns out to be the most"}, {"start": 129.16, "end": 133.12, "text": " important thing for predicting the price of the house."}, {"start": 133.12, "end": 139.64000000000001, "text": " What we just did, creating a new feature, is an example of what's called feature engineering,"}, {"start": 139.64000000000001, "end": 144.88, "text": " in which you might use your knowledge or intuition about the problem to design new features,"}, {"start": 144.88, "end": 149.92000000000002, "text": " usually by transforming or combining the original features of the problem in order to make it"}, {"start": 149.92000000000002, "end": 153.92000000000002, "text": " easier for the learning algorithm to make accurate predictions."}, {"start": 153.92000000000002, "end": 158.68, "text": " So depending on what insights you may have into the application, rather than just taking"}, {"start": 158.68, "end": 164.08, "text": " the features that you happen to have started off with, sometimes by defining new features,"}, {"start": 164.08, "end": 167.84, "text": " you might be able to get a much better model."}, {"start": 167.84, "end": 171.24, "text": " So that's feature engineering."}, {"start": 171.24, "end": 175.20000000000002, "text": " And it turns out that there's one flavor of feature engineering that will allow you to"}, {"start": 175.20000000000002, "end": 180.60000000000002, "text": " fit not just straight lines, but curves, nonlinear functions to your data."}, {"start": 180.6, "end": 197.04, "text": " Let's take a look in the next video at how you can do that."}]