i can't visualize 3d space when drawing
How to Translate A Profile Plot
Visualize 3D Surface in 2d Contour Plot
Drawing in three dimensions is inconvenient, a contour map is a useful alternative for representing plots in 2nd space. Contour map uses contours or colour-coded regions helps us to visualize 3D data in ii dimensions. Contour maps are likewise used to visualize the error surfaces in deep learning/machine learning optimization techniques like Slope descent, Momentum gradient descent, Adam, etc…
In this article, we will see how to translate the profile maps and visualize the 3D Gradient descent error surface using a profile map.
Citation Note: The content and the structure of this commodity is based on the deep learning lectures from I-Fourth Labs — Padhai.
Permit's assume that my 3D Mistake surface looks like this from the forepart view,
The x-axis in the graph represents the combination of two parameters w, b represented as ane parameter theta and the y-centrality represents mistake value. Suppose if I take horizontal slices of this error surface along the vertical centrality. How would the error surface look like from the meridian?
The inner ellipse corresponds to the first slice and outer ellipse corresponds to the second slice on the fault surface from the top. Each horizontal slice is like a plane that is cutting this hat like fault surface and the loss function value around the entire perimeter of the sliced chapeau will exist the same. It means that the loss function value around the unabridged perimeter of the inner ellipse will be the aforementioned. Similarly, the loss function value around the entire perimeter of the outer ellipse volition be the aforementioned.
Think that whenever yous meet a boundary in the contour map blindly follow that the loss value around the unabridged purlieus is same.
If you notice the mistake surface from the meridian the altitude between two ellipses is not equal. At the left side, the distance is more and at the right, the distance is less. The reason for this is that the shortest altitude betwixt two ellipses marked in red corresponds to the expanse where the gradient is very steep in the error surface.
Similarly, the longest distance between ii ellipses marked in yellow corresponds to the area where the slope is a bit gentle in the error surface.
The cardinal takeaway from this analysis is,
- A small altitude between the contours indicates a steep slope along that direction.
- A big distance betwixt the contours indicates a gentle gradient along that direction.
Using this intuition at present nosotros will run across some second profile plots and understand how to translate them.
Let'south presume that we have a 2D contour plot of a 3D surface error surface as shown below, now can you imagine what the 3D surface would look like?
The darker the shade of red indicates higher the loss value and darker the shade of bluish indicates lower the loss value. For all the contour plots shown in this commodity, I will be following the aforementioned color schema.
Every angled line you come across in the contour plot represents i cut forth the vertical axis that means the error (loss value) is the same along the line. If you look at the contour nowadays at the extreme left side of the plot (marked with yellow in the below figure) in that location are no other boundaries or contour surfaces towards the left side in dissimilarity to the right side where y'all tin meet a cluster of contour surfaces very close to each other.
As there are no contours present on the left side I can say that the altitude between the 2 contours (contour marked with yellow and some other contour located far away towards the left, if nowadays) is very big considering I can't see any profile in the vicinity. If the distance betwixt the contours is large that means the slope in this surface area is very gentle so this area in the 3D plot volition exist a flat region.
Is it a depression apartment region or high flat region?
It is going to be a high flat region considering the color is ruddy that indicates the mistake value in this expanse will be high. Similarly, if we look at the contour present at the correct extreme of the plot (marked with black in the below figure) there are no boundaries towards the correct side that ways the slope in this area is also very gentle and it volition exist a apartment region, it will be a low flat region because the color in this region is blue that indicates the error value in this area volition be depression
Now we expect at the region between the two extremes (marked with majestic in the above figure) information technology indicates that we are transitioning from high flat region to low flat region and the transition is very rapid. If y'all look at the contours nowadays in this middle region they are very close to each other, we know that if the distance between the contours is very less that means in that location is a very steep slope between the contours.
Now permit's come across how the 3D surface looks like,
We started from the high apartment surface (nighttime red) and the loss value was abiding for a long time because the surface is flat. We are transitioning very quickly from the dark ruby region to the dark blue region because the slopes were very steep in this region. This is how we interpret the profile maps and imagine how the 3D surface would look similar from the corresponding 2d surface.
We will run across one more contour map for practice so we will move onto visualize slope descent fault surface.
Nosotros will start with the corners of the plot and figure out where are the flat surfaces or plateaus located and and so we will figure out where the valleys are located. Commencement, by looking at the regions marked(with black) in the below plot we can see that the distance betwixt the contours is big that means the slope in these regions volition be gentle and these are flat surfaces.
Also, the shade difference between the corresponding contours is not big it means that they are close to each other and the loss value is not decreasing that much decreasing between the contours. These flat regions will exist high regions because their color is coded in cherry-red that indicates the error value will be loftier in these regions.
Now coming to the blue regions of the plot marked with yellow lines, the distance between the contours is big that means the gradient in these regions will be gentle and these will be flat surfaces. The mistake value in these regions will be on the lower side because these are color-coded in light blueish. The white region in the plot indicates that when nosotros are transitioning from cherry to bluish somewhere we hit the white colour. The fault value in the white region will be medium information technology'southward not high and non low.
The topology of this white region too is a flat plateau because the distance betwixt the 2 consecutive orangish contours is large. Let'south come across how the 3D surface would expect similar,
Equally we interpreted, we have the iv plateaus at different heights based on the mistake value and all of these four plateaus are rapidly converging into the valley (night bluish region) where the fault is minimum.
Visualize Gradient Descent on 2D contour Map
To generate the 3D gradient descent loss surface, I take taken some toy data and iterated over all the data points for 1000 epochs and computed loss for different values of w and b. In one case I got the loss values for all possible combinations of w and b, I was able to generate an blitheness that shows the gradient descent rule in action.
The points at the bottom betoken the different combinations of w & b (parameters) and the points on the contour betoken the loss value for the corresponding parameter values. Past looking at the 3D plot effort to visualize how the 2D contour plot would look like, from the gradient descent loss animation, y'all would have observed for the kickoff few iterations while the bend is still on the flat light ruby-red surface the updates are moving very slowly that means we would await the distance between the contours is big.
Once the curve reaches the edge of the plateau it rapidly converges into the dark blue valley that means nosotros would expect consecutive contours to be very close to each other. Now let's meet how the 2D contour look similar,
As expected in the region where the slope descent curve starts, the altitude betwixt the sequent contours is large. In one case the curve starts to movement towards the night blue region we can see that the distance between sequent contours is very small that indicates there is a steep gradient along that direction.
At present we will come across an animation which shows how the gradient descent update moves on the 2D contour plot.
That'southward most information technology, this how we interpret profile plots.
Conclusion
In this mail service, nosotros have seen that using the distance between the contours we can tell how the gradient is moving along that direction and and so nosotros went on to interpret a couple of contour plots. Nosotros and so visualized 3D gradient descent error surface using a contour plot and interpreted it likewise.
Continue Learning
Equally a data scientist, one of the important skill is to create visualizations for presenting your results to the clients. Microsoft Excel is one of the most widely used tools across the industry for data analysis and visualizations. Check out the Microsoft Excel Masterclass: From Zilch to Hero course by Abhishek and Pukhraj from Starttechacademy.
In my next post, we will talk over the unlike variants of slope descent optimization algorithm similar Momentum, Adagrad, Nesterov Accelerated, etc.. and we will besides utilize contour maps to visualize the mistake surfaces in each of these optimization techniques. So make sure you lot follow me on medium to become notified equally soon equally it drops.
Until so Peace :)
NK.
Niranjan Kumar is an intern at HSBC Analytics sectionalization. He is passionate nigh deep learning and AI. Currently, he is one of the tiptop writers at Medium in Artificial Intelligence. Connect with me on LinkedIn or follow me on twitter for updates about upcoming articles on deep learning and Bogus Intelligence.
Disclaimer — In that location might be some affiliate links in this mail service to relevant resources. You can buy the bundle at the everyman cost possible. I will receive a modest commission if you purchase the course.
Source: https://medium.com/hackernoon/how-to-interpret-a-contour-plot-a617d45f91ba
0 Response to "i can't visualize 3d space when drawing"
Post a Comment