When developing learning algorithms, very often a few simple plause can give you a, better sense of what the algorithm is doing and just, sanity check that everythings going okay, and the algorithms doing what it's supposed to. For example, in an earlier video, I talked about how plotting the cause function J of theta can help you make sure that gradient to sense is converging. Often, plots of the datar, of, of the learning algorithm outputs, will also give you ideals for how to improve your learning algorithm. Fortunately, Autive has, very simple tools to generate loss of different plots and when I use learning algorithms, I find that plotting the data, plotting the learning alger, algorithm and so on, are, often. Important part of how I get ideas for improving the algorithms, and in this video, I'd like to show you some of these octave tools for plotting and visualizing your data. Here's my octave window. Let's quickly generate some data for us to plot. So I'm going to set t to be = to, you know? This array of numbers. Here's t. Set of numbers going from, zero up to.98. Let's set y1 = sine of two pi 4t. And if I want to plot the sine function, it's very easy. I just type plot t, y1, and hit enter. And out come this plot where the horizontal axis is the t variable and the vertical axis is Y1, Which is sort of this sinusoid function that we just computed. Let's set y two to be equal to. The cosine of two pi four T like so, and if I plot. T, Y2 What Octave will do is it will take my sinusoid plot. And it will replace it with this cosine function. There, now, you know, cosine of X [INAUDIBLE] say one, right? No, what if I want to have, both the sine and the cosine plots on top of each other? What I'm going to do is I'm going to type. Plot T comma Y, one. So here's my sine function. And then I'm going to use the function, hose on. And what hose on does, is it causes [INAUDIBLE] to now plot new figures on top of the old one. And let me now plot T, Y2. I'm going to plot the cosine function in a different color. So let me. put A, an R in quotation marks there. And instead of replacing the current figure, it'll plot the cosine function on top. And the R indicates, the [INAUDIBLE] color. And here are additional commands. X label time. A to label the x axis or the horizontal axis. And Y label values A to label the vertical axis value. And, I can also. [COUGH] And I can also, label my two lines with this command. Legend, sine, cosine. And this puts this legend on the upper right, showing you what these two lines are. And finally title Y plot puts a title at the top of this figure. Lastly if you want to save this figure you type print D [INAUDIBLE] DGNP. My plots, P and G, so P and G is a, graphics file format, and, if you do this, this is where I should save this as a file, but if I do that, then we actually change directory, to, let's see. [INAUDIBLE] that. And then, I will print that out. So this will take a while, depending on how your, Octave configuration is set up. This may take a few seconds. But, change directory to my desktop. And Octave is now taking a few seconds to save this. If I now go to my desktop, [COUGH], let's hide these windows here's my plot dot PNG which octave has saved, then you know, that's the figure I have saved as a PNG file. Octave can save thousands other formats as well so you can type help plot if you want to see the other file formats, rather than PNG that you can save figures in. And lastly, if you want to get ride of a plot, the closed command. causes a figure to go away, so there's a figure and if I type close, you know, that figure just disappeared from my just disappeared from my desktop. Octave also lets you specify a figure or a number. So you type figure, one, plot T, Y1, that starts up a first figure in that plus T Y1 and then if you want a second figure you specify a different figure number so figure two plus T Y2, like so and now on my desktop I actually have two figures, figure one and figure two, one plotting the sign function, one plotting the cosign function. Here's one other neat command that I often use which is the subplot commands, I'm going to use subplots 121 what this does is divides, subdivides the plots. Into A one by two grid, that's what the first two parameters are, and in response to, access the first element, that's the what the final parameter one is, right, so this, divide my figure into one by two grids and I want to, access the first element right now, and so if I, take that in, this product, this figure is on the left and if I, plot T Y1, it now fills up this, . You know, first element and if I now do subplot one, two, two. I'm going to start to access the second element and plot T, Y2. Well, throw in Y2 in the right hand side or the second element. And lost command you can also change the axis scale and change axis to open five one minus one, one and this sets the X range and Y range for the figure on the, on, on the right and [INAUDIBLE] says the horizontal range of values and the figure on the right to range from 0.5 to one and the vertical axis values to range from -one to one. And you know, you don't need to memorize all these commands if you ever need to change the axis all you need to know is that there's an axis command and you can really get the details from the usual auto help command. Finally just a couple of last commands - ClF Clears a figure. And, here's one more neat trick. Lets set A to be equal to a five by five matrix square, say, so A is now this five by five matrix. There's a neat trick that I sometimes use to visualize a matrix, which is I could use image S, C. Of A and what this would do is this would plot a five by five matrices so it'll take my matrices I'll plot this as a five by five grid of colors where the different colors correspond to the different values in the A matrix. So briefly I an also do color bar let me use a more sophisticated command if we just see A color bar, color Map gray this is actually running three commands at a time, running every emesher FC, then running color bar, then color map gray and what this does, is it sets the color po, map, it's a gray color map, and under writed also puts it in this color bar and, So this color bar shows what the different shades of color correspond to, curan frequently, the upper left elements of, the A matrix is seventeen, and so, you know, that corresponds to. Kind of a mid shade of grey, whereas in contrast the second element of a, the one two element of a is 24 versus a one two is 24. So that corresponds to this graph here which is nearly a shade of white. And the small value say a, what is that a, a four five Know is the value three over here that corresponds. You can see how my color bar that corresponds to much darker shade in this image. So here's another example I can plot a larger you know. Here's a magic fifteen that gives me a fifteen by fifteen magic square and this gives me a plot of what my fifteen by fifteen magic square's values looks like. And finally to wrap up this video. What you've seen me do here is use common training of function cause here is how we actually do this [COUGH], if I type A plus one, B equals two and C equals three. And hit enter. Then this, this is actually carrying out three commands at the same time or really carrying out three commands one after another. And it prints out all three results. And this is a lot like equals one, b equals two, C equals three. Except that if I use semi colons instead of a comma, it doesn't print out anything. So, this, you know? This thing here we call comma chaining of commands or comma chaining of function calls. And it's just another convenient way in Octave to put multiple commands like [INAUDIBLE] color bar, color map. To put multi commands on the same line. So, that's it. You now know how to plot different figures in Octave. And, in the next video. The, the next main piece I want to tell you about is, how to write control statements. Like if, while full statements in Octave. As well as how to define and use functions.