Submind YouTube summaries
Thumbnail for Lesson 05 – A softer perceptron, part I: probabilities

Lesson 05 – A softer perceptron, part I: probabilities

Watch on YouTube

Video summary

This lesson introduces the concept of a "softer" perceptron, moving away from the rigid binary decision boundaries of traditional models to a probabilistic approach that quantifies uncertainty. In standard binary perceptrons, data points are strictly classified as either belonging to one class or another based on whether they fall on a specific side of a decision line; however, this method struggles with non-linearly separable data and offers no way to distinguish between a point slightly off the boundary and one far away. The lecture proposes improving this by introducing a degree of "belongingness," where points exactly on the decision line are assigned a 50/50 probability, while points further into a class region approach probabilities of 1 or 0. This transition allows the model to express confidence levels rather than making hard, deterministic guesses, effectively changing the output from discrete values (0 or 1) to a continuous range between zero and one. To achieve this probabilistic output, the video explains the use of the logistic sigmoid function, which maps the raw inner product of the input features and weights onto the 0-to-1 interval. The behavior of this function is controlled by a parameter known as "coolness" or beta; when beta approaches infinity, the sigmoid function behaves like a step function, reproducing the sharp, binary nature of the original perceptron. Conversely, lower values of beta create a smoother curve that allows for gradual transitions in probability. This concept is further illustrated using an analogy of ice cream: increasing coolness freezes the system into a hard, binary state, while decreasing it melts the system into a soft, probabilistic state. This same principle applies to modern large language models, where lowering the temperature parameter (increasing coolness) yields sharper, more deterministic outputs, whereas higher temperatures introduce randomness and variety. The lesson concludes by shifting focus from classification to probability theory using a coin flip example to demonstrate how likelihood works in an unconditional setting. By analyzing a sequence of four coin tosses, the video shows how the probability of a specific outcome is calculated by multiplying individual probabilities, resulting in small numbers that are easier to work with when converted into log-likelihoods. The core takeaway is finding the maximum likelihood estimate—the specific parameter value that makes the observed data most probable. While this segment covers unconditional probabilities for independent events like coin flips, it sets the stage for future lessons on conditional probabilities, where the model will learn weights by maximizing likelihood to determine whether an input, such as an email, belongs to a specific class like "spam" or "not spam."
Read the full video transcript
So, let's get back to the binary perception, and let's see how we can improve it, right? What do you mean improve? Well, let's see what are the Well, we saw a few limitations. Let's see whether we can improve on what we saw. So, lesson number five. The software perceptron. We are starting here by recalling what is this decision boundary. So, we're going to have deterministic versus probabilistic decision boundary. So, this is slightly recalled. So, let's figure out what happened here. We have our feature space. We have F1. We have F2. Then, we have our points. Some of them are going to be let's say here. And some of them are going to be here. Okay? Uh then, we know that to train like if we train a perceptron on this specific type of data, we are going to be roughly possibly coming up with a decision boundary that is like here. Let's say this is going to be the class one class, okay? So, where do I have to draw my weight vector? It's going to be orthogonal to this line, right? So, something like this. This is going to be my W. I just put the O, which is the one without the bias, right here, right? Because why do I need the bias? Because I also can shift this decision boundary. All right. So, no problem here. But, let's assume that I have a data point here. So, now this is a mistake, right? We cannot fix. We cannot do anything here with the perception. Every single time that you have a situation where where data is non-linearly separable, the decision boundary will keep jumping around over and over, right? And so, this is Well, this is a mistake, right? And we can't really handle mistakes. Is it a good mistake? Is it a very bad mistake? Or is it a ish okay mistake? Like, what what is the difference if I have my red dot here? Or it's just next to the decision boundary. Right now, we don't have any qualification of these mistakes. A mistake is a mistake if it's falling on the wrong side of the decision boundary. But perhaps we would like to have a to introduce a degree of belongedness. Meaning, if I am exactly what is the equation of this line? X times W transpose X. Someone again? W transpose Right. So, this is going to be W transpose X. Equals zero. Equals it, right? So, this is the one without the circle. This is This has the bias inside of it. All right, sweet. So, if we are exactly on this line, if I like, if I fall on the line, we shouldn't really consider that a huge mistake. Like, the model is going to be saying that that's likely 50/50, one class, 50 the other one, right? So, it's like half half. How about I'm very close to the line over here. So, maybe I'm not very sure about this point. But as I move further away, what happens here with the inner product? It stops here, over here. It's very positive or very positive. So, here it keeps growing, right? And how about on this side? It keeps getting smaller. So, what type of surface would you What does this thing describes? If you understand my question. If you don't It's a parabola in some ways. No. Parabola is no no no. >> [clears throat] >> Something like that, right? So, in the on the hinge it's on zero, then the stuff comes out here linearly, and then it goes down linearly. This is the equation of a plane. All right, the plane comes out this way. And this is like this one is going to be the equation of the plane with the equal zero. You're going to check whenever you run across in the the board. Okay, let me let me make some more drawings. Uh the point is that if you are near the decision boundary, we shouldn't be too harsh on the mistake. If you are further away, then might be more bigger mistake. So, let's introduce here this degree of belongingness. So, I have the same type of diagram. We have the same data points. On the line, we can say it's going to be 0.5, all right? And then 0.5 blue. Then, we may have some line over here, which we might say it's going to be less or more red. More red. More. Less. It's more red cuz we have more red points. On the dash line. Are we more This is the positive class, this is the negative class, right? So, this is less red according to the model, right? So, this one might be 0.3. And then Oh, maybe that is this No one tells me anything, right? 0.7. >> [clears throat] >> Uh if I have another one here, I may have something like 0.1 and 0.9. So, here I'm pretty sure this is going to be blue. As I approach this line, I'm not really certain, and then it's like on the other side, I have the reverse. So, this is going to be 0.7 and 0.3. And then, finally, I have 0.9. And then, 0.1. So, now we have we we changed from having like this deterministic decision boundary to a softer type of decision boundary, uh which tells you again the level of belongness of those points to one or the other class. So, let let's say how much is uh the inner product here? We said the inner product here, you already saw it in both equals zero. How about the inner product over here? Uh it's it's positive. Let's say, for example, just say a random number, this is going to be the coordinate which is equal to plus five. And then, let's say this guy here is going to be the line for equal negative five. So, which function have we encountered that allows me to assign it maps zero to 1/2. It maps plus five to roughly one. And then, it maps negative five to roughly zero. It's a plane, the logistic sigmoid, right? So, we already encountered this function before. So, let's bring it uh here. So, we're going to be using the logistic sigmoid to convert these items here into basically the red number you can see. And similarly here, this number over here is going to be converted into this red number you see. Can I ask something? Yeah, sure. You can ask anything. Why is it that when the line is more red, when it's less red? I still don't understand that. You see me right here? Yeah. You see blue here? Yeah. Okay. You see in this case before we had a mistake, we were assuming that this was the decision boundary my Yeah. perceptron was making. Red side is going to be this side, positive side. Negative side is going to be blue side. Okay, yeah. >> Then we end up having additional and additional red guy on the wrong side here. Yeah. >> So this is a mistake. Yeah. >> Good, bad we don't have a way to tell how bad or how good that the mis- that mistake is. Then we change to this kind of configuration where we actually are looking for different values of this inner product. The inner product here is going to be positive 2.5. Here is plus five. Here is zero. Negative 2.5. Negative five. So now we have like a gradual thing. Here it was either one side or the other. And now I'd like to convert this real number into a score or into this kind of belongness. One means you're 100% belonging to red class. Zero means you're 0% belonging to blue class. >> Okay. I'd like zero means on what are we doing red on one side and blue on the other side or how does it Yeah. I think he saw you were moving the decision boundary. Decision boundary is here. Uh yeah, I I think he saw you were moving around. But actually you refer to the area. I don't get it. Sorry. We're not moving the decision boundary. We're we're just looking at like if you're given an input feature Yeah. for the current weights of the model, right? Um Like what would it classify it as? Okay. >> And so if the model would classify this set of features as being a circle, so red, then that is the line that we would like uh have for this degree of redness, but the degree of redness is just a the inner product. Does that make sense? Okay. Just think about it. By the end of the class, I can give you the answer of your question once it has uh become understandable to me. Uh but the point was that in the same situation, we were only concerned before with the line where this inner product is equal to zero, and now we're actually considering all the possible values and then find a conversion to map positive numbers larger than five to roughly one, number lower than -5 to roughly zero, and the zero into 1/2. I don't know which class it should belong to. So, we said you actually said that we're going to be using the logistic sigmoid. So, let me actually give you the proper definition of the logistic sigmoid with the coolness coefficient as well. So, we have the logistic sigmoid function of the scalar value S is going to be 1 over 1 + exp negative beta S. Okay. If beta doesn't appear, like if we don't have beta, then we can imagine beta equal one. So, beta is called coolness. And we're going to be talking about the coolness in a sec. Let's draw this function here first such that we know how it looks like. We We did this already, right? I think last time. So, here we have +5. This is my S. This is going to be -5. And then this is going to be this +1. Then we're going to be or basically one over here. We're basically at zero over here. And then in the middle we're going to be hitting 1.5 here. And this is going to be our sigma one, right? Okay, so far no no questions, right? We already seen this before, right? How about if I draw sigma of five? What's going to change? How can I draw sigma five? Who wants to draw sigma five? What happens if I multiply by five my S? Yeah? So, each of the minus BS gets smaller as the value gets minus BS gets more negative. So, each of minus BS gets smaller. Then one over one plus BS gets bigger. So, it should be higher. It should meet the zero interception should be higher than a half. And then >> So, let's see what's happening. So, let's say this is going to be five. If you put S equals zero, how much is this expo zero? Uh same thing. Okay. So, let's try again. >> [clears throat] >> If where is this number five going, right? So, where where am I going to have number five if I have beta equal five? One. At one, right? Are you following? People are very lost right now. I don't know why you're lost. Why are you lost? You don't I understand what I'm asking? You don't know what's going on. I told you already, if you don't know what's happening, stop me because it means I'm speaking a different language than yours or I'm I'm drunk, right? Not this time. Last lesson, but you don't know. Where is going to be going my my inflection point? So, this point here where I hit the the zero it should be minus one. Minus one, right? So, this stuff goes to the right. Yeah. How about the plus five? Plus one. Plus one. So this one goes to the left. So whenever you have a multiplier for your variable that is going to be larger than one, you basically get your function to go faster right shrink towards the zero. Yeah. You said it was minus one. How do you get to minus one? Right. So I'm using beta equal five. Yeah. So whenever S equal one, yeah, the inside of this thing here is going to be five times as big. Yeah. Right? And so before we had to reach negative five to be basically touching zero more or less. Now by the time we are at minus one, we already hit hitting the minus five. I'm saying this the sigmoid function equals No, no, no, no. I'm saying that this stuff here that I'm drawing now with the blue color is going to be getting one, two, three, four, five, something like this, minus one, plus one. And so still one half in zero, right? Of course, nothing changed. It's going to be plus one here. It's going to be more or less zero here. And then this stuff here it goes down that way, okay? And this is for D. Beta equal plus five. So the larger the beta, the faster this thing changes. It's going to be squashed towards the vertical axis, okay? Questions? I think this is like I wouldn't say high school math, but I think it is high school math. I don't know. Let tell me if it's not the case. I don't want to be assuming. Okay, people take pictures. All right. I mean, sweet. Okay, moving forward. So let let's actually be a little bit more mathematical and let's check what's happening if we take the limit for beta that goes to plus infinity. Okay, so I haven't told you why it's called coldness. I'm going to tell you in a sec. Let's look at something that is called the zero temperature zero temperature limit. Can you guess what is the zero temperature limit? If the coldness tells you how cold that something is, how can we go to super cold? What is the coldest thing you can reach? What what is the I mean, you already know, yeah. And what? What is the lowest temperature you can go to? Zero. Zero, right? I mean, that's there is What what is the temperature, right? What is the meaning of temperature? We have We study physics. When molecules are moving. The guy Go again. The activation of particles. The energy Kinetic energy. The average kinetic energy of of particles. particles. Molecules, right? How much this stuff vibrates? How much you cannot vibrate? Zero not vibrating. We stop moving, right? We should stop moving. It's zero temperature. Then you start moving, it's get getting warmer, right? That's why when you go running, you get hot. Is it? Maybe. All right, anyways. You don't get my jokes. It's okay, don't worry. So, we're going to be talking about limit for beta that goes to plus infinity. So, what happens if we go for beta that goes to plus infinity? Uh we have that sigma of beta of S tends to tends to zero if it's negative and one if it's positive. >> Yes, how do we call that function? Heaviside. Yes, Heaviside function. So, this stuff becomes the Heaviside function or we can We have a different notation for the Heaviside function. Square bracket as a bracket. Yeah, the I forgot the name of the the notation, but something like that, right? Uh you can check. I forgot. This is actually a mathematical thing. Anyway. So, Oh, and one case and a zero is a half. We haven't put that. Right. So, now you actually have the proper Heaviside which actually hits the the 0.5 in a in in zero. Okay? The other one this one doesn't wasn't hitting the 0.5. I guess you can assume they are the same. So, they are exactly the same beside for one point, right? Which is the 0.5. Okay? Yes, no? I hope so. But now we have this function here. This function for which we're going to forget completely about the beta for today. Uh we're just going to use the sigma one, right? So, don't just call it logistic sigmoid. Every time you hear about logistic sigmoid, it's just sigma. There is no one, it's automatically sigma one. Because if it's one, then the beta disappears as a multiplier. Okay, so let's get back to whatever setup we were talking about here. We are going to be expressing this red number, which is the degree of belongingness, of a specific a specific what? What are we talking about here? What are these red numbers? I introduced not very precisely, but what do they represent? Second? I didn't hear what you said. Yeah, I know. That's the specific word, but That is actually even better. Yes. Uh before getting to actual words that I I we don't know maybe the meaning, let's try to understand what it means. So, this number here, this red 0.1, represents what? The level, the degree of belongingness, of what? Of a red point being >> Of the red point, which is what? What is the red point? Don't forget where we came from. Plus one. That's No, no, no, no, no, no, no, no, no, what is the red point? Correct. Okay. What is each of these points? Where where are we? What is this the serial boundary of feature it's part of the feature. So it's drawing here is a specific feature vector that lives in my feature space. What are these features? Where do they come from? Real world from the object from the object very good. So what was the name of the object X very good. Right? So given an X given an let's say email right? That's then what what do we do? Extract the features. We compute the feature right? We can compute which is living in the feature space very good and has that we express with this kind of notation the level of belongingness of this specific email to the class Y equal 1 is going to be given to us by our huge function where there expresses all this stuff here expresses the model belief that X belongs to class Y equal 1. So this thing here is going to be a number between 0 and 1 which is going to be again the level of belongingness that that specific email belongs to that class number 1. That is the red. Say again. That is the red. That is the red. Yeah. That's one. Let me actually uh Okay. This is going to be additionally the output of my model. So, I'm going to be calling this Y given is defined as this item here or this thing over here. Okay, actually let me put this underneath here. I don't like it. This is going to be my Y given Okay. Yeah, the bias is still there, but it's just implicit, right? Sure. The bias is Oh, yeah, the bias is inside W without the If it has the the dot, I took out the bias. O means the original W. Then we introduce the bias. Maybe I should have flipped the O to the other I don't know. I don't want Os here, so I just The bias is already inside the weight. We forgot about it already. It just allows me to move the decision boundary around. Okay. All right, so this is going to be a scalar value between 0 and 1, which is a representing the level of belongingness of that specific object. If I have just an object that belongs to that specific class, this is like a a belongingness level thing. Then we have the other one, right? So, what is going to be the level of belongingness? How do I write the blue number? Y equals 0. So, that's going to be Y equals 0, which is the other class, for my specific object. This is super important, right? So, if you don't put the bar and the object, that means completely something else, right? Why is that the case? Because we are using the X to actually compute these things. So, it's a function of X. We are expressing the level of belongingness of one of those points. Right? Okay. This guy here is going to be Can you guess? 1 minus the other thing, right? So, 1 minus sigma of Sorry, it's inter interacting This is going to be 1 minus Okay. Uh I don't like it. Let's Let's put inside the equation. What's going to be coming out here? 1 minus 1 over 1 plus X of negative W X and then we can just 1 plus X of negative W X minus 1 1 plus X negative X 1 plus X of Wait, did I make a mistake? Uh Uh where did the X vanish? I know you did. Sorry, my bad. You just simplified this part. >> Very good. High school math. More questions? Sorry. Some of you are going to be like, "Oh, he's such an asshole." No, maybe. I don't know. You're thinking it, right? You know, some of you are. Questions? Are there questions? No, right? You can ask questions, so No, okay. You're You're You're very confused, okay? I can see your eyes that are like, "What's going on?" Right? Who asked the question? Oh, yeah, you should. Either you didn't have coffee today or you're confused. We don't know. You're just copying the blackboard. Okay, the point of coming to class is not to copy the blackboard, is to understand what's going on. We under- Do we understand what's going on? You can ask me the question. Yes. So, back to my question. Let's say 0.1, 0.9. Yeah. 0.9 is probability Y equals 1 given X. That is correct. Okay. And for that specific decision boundary or for what it No, no, these are not decision boundaries, they're level curves. This thing here is a level curve. Okay, what generates these level curves? Where did they appear from? So, this is a expression, right? Let me write it here. It's going to be W1 X1 + W2 X2 plus W0 >> W0 right? This is the inner product. Okay. If you evaluate this thing here, you're going to get a number. X If you write X equal this thing, what is X? X is going to be a function. X is going to be a function of X1 X2, right? It's a function of these X1 and X2. What type of function is this? What is the equation X equal It's a linear function. >> Okay, which is Okay. So, let's say we have this is the You see the boundary? Here, your plane coming out this way. Right. So, which keeps crossing the zero here? It keeps crossing the zero here. It is going growing positively on this side. It's going negatively down the other side. These lines here are the locations where you will be hitting the point 2.5, the five, negative 2.5, negative five. If you project them down, you have to go up, right? You have to project them on the on the feature space. Wait, wait, wait. Can I ask something? So, basically, on these lines, the probability that it's red is 0.1 and that's blue 0.9. Yes. Perfect. Done. Great. Other questions? Is this by design, like you want to train the model so that it has them? We haven't yet talked about training. But where does that probability come? Where it comes from? From the desire of having a attribution that is not longer zero or one, but it's now it's going it's going to be a number between >> zero and one. So, we are moving from the binary perceptron to something is that is going to give us a degree of belongingness that goes from zero to one. I can span the whole interval between zero and one. So, I have a degree of belongingness. Before, we chose either cat or dog. Now, you have a catty dog or a doggy cat. Does it make sense? Okay, you don't like it down there. Yeah. But the level curves it will be continuous, right? Like there will be infinitely many level curves and whatever line it lies on that's probability. Are there are there discrete numbers? >> This is the level curve for which the inner product is negative five. 7. -7.5 is going to be here. -10 is going to be here, and so on. All of them are equally spaced. Oh, so there so there are infinitely many curves. I mean, for -4.9 is going to be here. Negative 4.8 here. Also, you have [clears throat] negative points you know, 95. You have all the possible So, we choose how small we want to make their separation. For me to draw No, no, there's no separation. I just draw five lines. I decided that this is going to be the line where the inner product is negative five. This is the line where the inner inner product was negative 2.5. All of these are going to be parallel because we are dealing with a linear equation. You don't like my answer either. >> I assume there are infinite separations. >> Yeah. This is the only There is only one separation. Or There is only one decision boundaries. Let's put a like a summary here. What was for the binary perceptron? Binary Binary perceptron. What was the decision rule here? We were making the decision Well, we were assigning our prediction to be equal to binary perceptron. Binary perceptron. How do we estimate the Well, yeah, how do we perform inference? How do we compute the output given an input? >> [clears throat] >> Yeah, so and that was w times f what? Greater than greater than zero. And that was the definition for our activation. So, we had We said that our prediction is equal the activation and the activation was defined as being whether the inner product, right? Yeah, it was it was greater than or uh equal zero, okay? So, this is how we were making prediction, binary perceptron prediction, right? So, before we can either So, what are the possible values for Y tilde? Oh. Oh. Correct, right? So, we either have zero or one as an output. So, this Y is called binary, right? Binary. Now, we are no longer happy with this binary thing because it's either one or the other. We would like to be able to express the solution within all possible real values between zero and one. Therefore, we come up with the soft perceptron. Prediction. In this case, we have a different choice for the prediction. So, this is the symbol of the prediction. This is my approximation. In this case, we say this stuff is going to be the sigmoid of my output, my prediction, is no longer either zero or one. But, it's going to be all possible values between zero and one. Okay? Does it make sense? Yeah. So, this is like a degree of belongingness. Meanwhile, before we were making decisions. So, we are not yet making decisions here. Also, we know how to uh learn here. How do we learn? How do we find the weights in this case? We add or we subtract You either sum or subtract the feature vector to the increase or the weights. to the weights if If Y is not equal to Y hat. If you're making a mistake. So, if you're making a mistake, then you try to fix it until everything works. How do we learn uh the weights for the soft perceptron? We don't. For the moment. I mean, I know, but I'll tell you this Mhm. >> [clears throat] >> I'll tell you in a second. Any other questions? You have a question? No. Yes, you have a question. What's up? >> So, are we supposed to use one of the formula at one time or we are supposed to calculate both of them for each >> Very good question, right? So, let me actually write down one more important part here that I completely forgot. So, this is the level of belongingness of Y to the first class. This is the level of belongingness to Y to the second class. Let me write here what is going to be the this guy here. What is this item here? Now, Y is a variable. Before, Y was taking a value. So, Y in this case takes value one, Y takes value zero. Here, I'm expressing this as a function of my Y. Okay, it's going to be different things. So, this is going to be you can write it like this. And it's going to be uh sigmoid of W X or sigmoid of negative W for Y Let me write it right in red. And X X two for Y equals zero. So, now you have both values in one uh single expression. Let's get back to this binary perceptron and soft perceptron. What happens if I consider now back the coldness thing in here inside? How can I make the soft perceptron behave like a binary perceptron? You set the coldness to infinity. I freeze the system, right? So, this is a binary perceptron which is like very binary, like very either one or the other. And this is the the machine, like soft. What what's soft? If you have a ice cream, how you know, soft serve ice cream? How do you make it melt? You leave it in the sun. You either leave it or you put it in the microwave or something. If you have a soft soft serve ice cream, how do you make it very hard? You stick it in the freezer, right? That's the same thing here. So, if we have a softer perceptron, which is like the soft serve ice cream, how do we make the softer perceptron so hard? Yeah. You freeze it, right? You freeze the out of it, right? And so, you know that if it is a softer perceptron, I'm not yet demonstrating this today. It's going to be coming up maybe next. But then, if you take this guy here and you have that beta goes to plus infinity, >> [clears throat] >> which is going to be our zero temperature limit, then you have that the soft perceptron tends to go to the binary perceptron. Why is it Why do I talk about ice creams? This you have no idea how many times people can get this wrong. Every single time you're going to be using a large language models, there's going to be a parameter, which is called temperature or coolness or inverse temperature. Coolness is also called inverse temperature. So, now given that you know about ice creams, freezers, and ovens, can you tell me well, how you're going to be changing the temperature of a large language model to get sharper output? Whatever this means. Lower the temperature sharper. I know whatever this means, right? I'm not defining sharper, but I'm just trying to make you reason. Increase the coolness. You increase the coolness, but let's say I give you the temperature. You increase the negative temperature. Reduce the You decrease the temperature. You I decrease the temperature, right? So, the whole point is that if you want sharper output, you will make it cooler. Either you lower the temperature or you increase the coldness. But now the point is that if you're going to try to remember, oh I have to lower the temperature or you have no idea every single time people go get a random outcome, right? So, I don't want you to memorize anything. I want you to be able to reason. So, if you talk about temperature, it's getting hot, I'm melting. If it's talking about winter or cold, you get very very hard and spiky if it's going to be super cold, right? That's the way I would recommend you to actually think about these things because you will never forget it. You will never actually get it wrong. Otherwise, 50/50 is going to be you get it wrong. If you just try to remember how to which one goes up, which one goes down, okay? I know I'm funny, well I think I am, but I know this is not orthodox, but it works, okay? All right. All right, let me take a picture and we can erase the blackboard. more Yeah, we have 10 minutes to cover a new topic. Yeah. You're happy, right? Okay, sweet. Me, too. Okay, I was not expecting some of the questions some of you asked me today. So, Uh it's okay, don't worry. We always have uh things coming up differently. So, let's talk about coin flips. Coin flips. Uh let us assume Y = 1 represents a coin landing tails. I don't know why there is an S in this language in this English. Or it could be like in our case, spin. Right? And Y = 0 or a coin to land heads. I think I should have done the other way around, but I don't care. Whatever. Okay. Let's say that now the probability of Y = 1 is going to be a real number. I'm going to be calling it lowercase P. And then I'm going to have the probability for Y = 0. Well, if P is going to be one thing, the other one is going to be the other one, right? Is that 1 minus P. What is similarly to what we have written over there, the probability just for Y. I can write the curly bracket, right? This is going to be the variable. This is the variable takes the value. This is the variable takes the value. This is just probability of a variable. So, I have to put both cases here. So, I can write this as P for Y = 1, and then 1 - P for Y = 0. I can also write this in a different cute format that I might ask on the next quiz, which is going to be a compact version, but no no magic. It's going to be P to the Y times 1 - P to 1 - Y. You can see if Y = 0, then this goes away. You just have this 1 - P. If Y = 1, this one goes away. You just have P. Okay. No no big deal. And we said that Y in this case is going to be either 0 or 1. All right, let's take the coin and toss it four times. So, let's toss the coin four times. What's happening? You're going to have a sequence of events, right? So, we end up with something that looks like Y N and equal 1 to capital N. Now, what is going to be the probability that we have exactly that sequence of outcomes? So, let's say this is going to be 0 0 1 0. What is the probability for this item here, right? P times 1 minus P to the third. Yeah, how do you compute that? I just multiply the probability >> I have to multiply all these things together, right? So, let's do the multiplication of all these things together. So, we have N equal 1 to 4. P Y to the N times 1 minus P 1 minus Y to the N, which in this case, as you said, was just one of these guys here times 1 minus P to the third, okay? P is a number that goes from where to where? 0 to 1. Right. So, this guy here belongs to 0 to 1. What happens if I multiply the four numbers in between 0 and 1? It's going to be smaller. It gets very tiny, okay? We don't like small numbers. So, how can I make that very large? Let's take the log. What's happening here? We're going to have log of P and then plus three times log of 1 minus P. We have either this expression or this expression. What's the name of this thing here? This thing here is called the likelihood. What's the definition of likelihood? Likelihood is going to be the probability that the model assigns to So specific data that you're observing, the specific sequence of throws. How about this guy here with the log in front? Log in L. Okay, sure. Log likelihood No, no, no magic. What would we like to do? What happens if it's a fair coin? What is going to be this likelihood? .5 raised to 6 No, .5 raised to the power of 2. But but but but but but well, how much is the likelihood if this is a fair coin? .5 raised to the power of 6. 1 over 1 over 16. Okay. Is this a fair coin? We don't know. Well, we we don't know, but what would be the probability that gives me the largest likelihood? What is the probability that gives me the maximum likelihood? So, how does this How does this look? Do we know? Okay. So, for this this value over here, this is 1 over 16. This is going to be my P. How about the log likelihood in green? Where is going to be the maximum of this thing? At the derivative, which is 1 over 4. Where the derivative is 0. That point, yeah. It's going to be So, if I take the log of a number that is between that is between 0 and 1, where do I draw it? Log of a number between 0 and 1, it's negative. Okay. So, it's going to be something like All right. So, both the orange and this green guy share the same location of the maximum. And so, what is going to be this location over here? This is the location where the likelihood is the maximum. So, this is going to be called the maximum likelihood. Arc maximum, right? We call it arc maximum likelihood. Like likelihood. Okay. Right? This is the location where the likelihood is the max. All right. So, how can we compute this value here? We just take the gradient of this thing here and then set it to zero, right? We can do this, right? You know, we already finished the class. Let's finish. So, we can take the derivative of the log of this thing here. So, we have 1 over P then plus three 1 over minus 1 over P. Which is going to be 1 minus P minus three divided by P times 1 minus P. Uh we are not considering P equals zero or P equal 1, of course. So, if P is different than zero and P different from 1, I can set this up to be equal to zero. And so, we end up having a minus 3 P minus another P, so minus 4 P's and then equal 1. So, we have 4 P's equal 1. Therefore, we have that P equal 1/4. Which is exactly this is the likelihood arc maximum. If you want. And so, in this specific case, let me finish the the sentence and we are done. We found out that if you change this P parameter, you can find the location where the likelihood, which is the probability that the model assigns to the specific collection of data I have, is the maximum. Okay? So, today we have seen this This was the unconditional case. This is doesn't have bars. In the next episode, we're going to be expanding this to the conditional case, where we actually looking at something. So, in this case, I have a coin. I just tossed the coin four times. I'm not looking at anything. So, I compute all these things. Yes. Next time, I go look. Is this an email or a spam? Then I come up with a conditional probability. We're going to find out what are the weights that are maximizing this kind of this likelihood. Thank you for listening. I'll see you next time. Bye-bye.