Now, in this demo, we're going to take a brief aside and touch back on the curse of dimensionality. Distance measures will come into play slightly as we will talk about the Euclidean distance for each of these. But the focus here is going to be the curse of dimensionality. So with that in mind, we can talk about the demo objectives, which will be to gain a deeper understanding of why observations are going to be further apart once we move to higher dimensional space. We're then going to see an example of how adding dimensions will ultimately degrade certain model performance when we're working with the classification. And then, we're going to start to learn how to fight that curse of dimensionality within your different modeling projects. So the main point, is that, in higher dimensional space, points will tend to be further apart. And this is going to impact our data analysis, intuitively, if we think back to the clustering examples that we've already gone through. And we're talking about how distant each one of the different points are from one another, and saying, what the nearest neighbor really is? Can we really say it's a neighbor if it's a certain distance apart? If we're moving an incredibly far distance apart, once I moved to these higher dimensions. So this notebook will show why higher dimensional space does lead to this sparse data, leads to data points being naturally further apart from one another. So we're going to start off with a circle inside a square, and the idea is that we're just going to have a square. That's going to be the diameter of the circle, that's going to be the length, the width, and height of our square, right squares, width and height are automatically going to be the same. We're going to have a unit circle, so that our length is going to be 2, and then, our width is going to be 2, and our height is going to be 2. And the point is that that circle should touch the borders of our square. And we want to know, using that circle within the square, how much of that is empty space? And then, we're going to move to the next step, and create a sphere within the cube, using those same dimensions one by one or two by two radius of one. And we're going to see how just moving to higher dimensions, using those same points, we're going to have a larger proportion of the space, not covered by that circular object. And then, generalize that to higher dimensions and discuss how, as we move to higher dimensions, just the fact that we're moving to higher dimensions, leads to there being more empty space within our square, or that square moved into higher dimensions. So the point is to bring in that concept, but I'd be remiss if I didn't also walk you through a lot of the new code that we're going to be talking about as we go through some more complicated plots. This way, when you're back home, you will be able to go ahead, create these plots on your own, understand what went into the code, as well as once we get to the next couple of cells, being able to start to even plot in three dimensions. So with that in mind, I'm going to create an empty cell above, so that we can walk through all the different code that's within this function. So to start off, we're going to initiate our figure, And, we then, so plt.gcf is going to be a way to get current figure. If that figure doesn't exist, it will initiate a new figure. And then, taking that figure, we're going to add on our subplot, and that's going to be our axis, and we're just saying one by one. If you think about subplots, they can be two by one, or two by two. If you say two by one, you'd have two rows with each [INAUDIBLE] bounding box, and then, one column. And we're saying, which one do we want to select? We're just selecting that first one. And then, we're saying aspects ==, and this is going to be similar to what we saw in the last notebook that we had, when we want to draw that circle, and the importance of actually ensuring that our X-axis and our Y-axis on the same scale. If one of those are on the wrong scale, then it looks like we have a rectangle rather than a square, or an oval rather than a circle. So we run this, and we see that we now have our bounding box going from zero to one. Now, I'm going to skip over quickly and we're going to come back to it. This building in of the circle, because this is going to be the circle like we mentioned, centered at 00. And then, going from 0 to 1, and then, from 0 to negative 1, as well. And our box currently only goes from 0 to 1, not from negative 1 to 1. So I'll bring this back into play, once we walk through this code where we increase our x limit and our y limit. So then we're going to add on this scatterplot, which is just going to be that single dot, because it's 00 is the point that we're bringing in, and we are saying that we have the size equal to 10, and the colors equal to black. That's that 00, and now, we've changed the scale a little bit to that's in the center, but again, it's still not that -1,1. We're then going to add on a straight line, and this is going to represent the radius of our circle. So it's going to go from zero to one. And we're going to have 1,000, 100, sorry, different points. So it goes from zero to one, counted by 100. And then, that's going to be each one of our x values. And then, for the y values, we're going to stay at zero. And this will allow us to create that straight line that we see here. Again, let's mess with the axis a bit, so the plot looks a little bit funky, but we'll see in just a second what this looks like once we increase those, in fact, I'll do that right now. Let's change the x limit and y limit. We're going to add this on to our graph. We have to make sure that we have no extra tabs there. And now, we see it goes from 0 to 1, and it goes from, 0 to 1 is the line, and we're able to see negative 1 to 1 on our x-axis, and negative 1 to 1 on our y-axis. Now, we can go through some of the pieces that we skipped over. So coming back first to the circle, and this is something that's probably the most new, for those that are watching through this video. What we're doing is we're getting the current axis, which is just our bounding box, and then, we're calling this add artist. And then, artists object is essentially anything that you have within your plot. That's going to be your tics, that's going to be your numbers, that's going to be your lines. Those are all artists objects. When we call plt.circle, that's going to be a subclass of that artist object. And it won't show up unless we call add artist. And you can google and look at the discussion on add artists and how it works in regards to creating your matplotlib plots, and different ways that you can use this. But the idea is that it will take things that are subclass of that artist object, be able to add it on. So we're adding on this circle, the circle is going to be centered at zero with a radius of one. And then, we're saying alpha equals 0.5. That's just how opaque our circle is, the same way that we saw alpha earlier. So we run this, and now, we have a circle on our plot. So we have our circle within our bounded square. We're then going to add on an R. So we're just adding text. So x.text And we're saying that we want an R, we can say the size of that R, and where we want it to lie at .4, .1. So we have that R there at .4 and .1. We've already set our X limit and Y limit. And, hopefully, you already familiar with setting your y label, your x label, and your title, but we'll throw that in. So we have all that with an R plot. And then, it's saying, when we say point equals zero here, I want to ensure that no one's misled. The way that it's being used is that point is equal to false. False in Python, or zero in Python will always be equal to false, whereas, any other number will be equal to true. So if the point is true, so if it's not zero as it is by default, then we're just going to create a dot. Sorry, we're going to create a dot here. That's at .85, .85. And we're just going to write on top of that. That it's a faraway point, just to highlight what we're signifying as a faraway point. So the idea is that each axis in this example is supposed to be a different covariant, and are supposed to imagine we've standard scalar data, so they're centered on zero. And this means that the average for each covariant is now zero, or the entire center of our circle, and points that are outside the unit circle would be harder to classify, because these values are far away from our mean. So this is just saying that values are outside the circle. So taking this idea of a circle within a square, and moving it to the idea of how it would apply when we're talking about creating our different machine learning models, is that we are now identifying that anything outside that circle is pretty far away from the mean as we have standard scalar data. And that means it's over a single standard deviation away. So we're going to run this, and we see our unit circle when we call make circle on its own, very similar to what we have above. And then, when we call make circle and we call one, rather than point equals zero, it's going to add on that faraway point. And that faraway point will be the same no matter what, it has nothing to do with the number you pass in. Again, it's just true versus false there. Now, the point that we want to make here, is how much of this square is going to be outside that circle. Again, thinking back to how this relates to our modeling, if we have standard scale that are two different covariance, which means that being one unit away from the mean, means that we're a standard deviation from the mean value for each one of our different covariance, covariance A, and covariant B, which will ultimately be using for predictions. How much of our points are going to be far away? Now, since the square has a length of 2r, the radius being one, and the area of the square is going to be 2r square, just taking the form of for creating a square, 2r times 2r. The percentage of square outside the circle is going to be one minus pi r squared, which is your area of your circle over two r squared. And that's just going to be the area, the circle over the area of the square. So it's one minus pi over four, once you cancel out the r squared, and you have that 1 minus pi over 4, means that approximately 21% of that square is outside the circle. So I'm going to pause here. And in the next video, we're going to extend this out to a cube and also walk through how you can create 3d graphs using Python. All right, I'll see you there.