Okay, welcome back, everyone. We're going to start with the first video in our module on functions. And this is going to be a little idiosyncratic. We're not going to talk about functions to start, the way most of you have probably seen it in early school. You're probably all used to seeing the idea of a function as a graph. That is if I draw this in the upper left corner here, your idea of the function is something like that. Some squiggly line, here's x, here's y and someone says that y = f(x). We'll get there, that's actually a way to visually depict a function from the real line to the real line. But what we're going to do here, and trust me there's a good pedagogical reason for it, we're going to start a little bit more abstract. Talk about the general concept of a function from a set to a set. Just work with me, and then we'll get eventually to the idea of where these graphs come from and what they have to do with what I'm talking about here. So here's a picture I want you to have in mind. Supposed you have a set A, it's the little bubble on the left, and a set B, the little bubble on the left. The general definition is that a function f from A to B is a rule or a formula or a machine, which simply transforms every element a and A into some element f(a) and B. So, really, by machine I mean it. So here's A, imagine this little cartoon of a journey. Here's A, little a walking along, gets fed into the machine. Lord knows what happens in here, we're sort of covering it up, censoring it with these blue dots, but some crazy stuff happens. And at the end of the day, out comes an f(a), that's an output over here. So it's very mechanistic, a is sort of an input, f(a) is an output, I think you can write that down. There's the input to the function, there's the output. And the idea is the function is the machine, it's not a graph. It's not any of the individual input output. It is the rule which transforms one to the other. Okay, great, that's enough talking. Let's get some examples. Let's take a really, really simple example of a set. Suppose our set A consists of 1, and 2, and 10. And suppose our set B consists of Apple, Daniel Egger, which we'll call DE, and Monkey. And we might define a function f from A to B. And really here you should have the absolute freedom to do whatever you want with the function. You might say that f(1) = Apple. You might say that f(2) = Apple. And you might say that f(10) = Monkey. So to give you that in pictures, here's 1, here's 2, here's 10. Here's Apple, here's Daniel Egger, here's Monkey. And f sends 1 to Apple, 2 to Apple, and 10 to Monkey. That's it, that's a function, it's a machine that does this. Why it does that we don't really know. Okay, the short of this isn't just a little gross abstract concept. Let me recast one of the things we did before in functional language. Suppose for example, that x is equal to all the people in the VBS study. That's the third time we've mentioned it. It may actually be a real disease, see if we can get a patent on the treatment. All people in the VBS study. And suppose y consists of two symbols, plus for positive, minus for negative. And let's define a function called test from x to y. This function is the medical test that we take when we want to tell whether or not you have VBS. All we're going to do here is say that test for the particular person. If we write the test of a person equals plus, that means that person tested positive. If we write that test of a person equals minus, that means that person tested negative. And so it's just a way of operationalizing the idea, it's that function. Let's give another example. Suppose you're running a business. And let's say that capital Y stands for all the years. So this might be going from 2010, 2011, 2012, on forever, and over here on the other side we have the real number line. Define a function called Profit. From Y to R. Where profit of a particular year is equal to the profit in that year, profit / loss in that year. You can see here why the target of the function, the real line, is the real line, because you might want positive or negative. It might be that profit In 2011 was $1,007 that might be the profit in 2012 was -10,000. This might be a typical thesis on running. We're not doing that well for example. So that's the basic concept. There's really not much more to it that's a function from a set to a set. Okay, so let's get a little bit more advanced here and tie into something that you see a lot in machine learning. The dirty truth is that you don't actually have functions in life, usually. You don't know what every input to output is. Very often what you do in what's called supervised learning is figure out functions from a little bit of examples of input and output. So, for example, the profit function. From years to the real line, you actually knew what that was. You knew what every output would be for every input. If you know what profit of the year was for every year, you'd be in business, as they say. If you knew what the result of test was on every person, you wouldn't have to give them the test. Very often what you do in Supervised Learning, is you're often given some examples. So for example if you're trying to figure out you have a set A and a set B and you have a mystery function f and you're trying to figure out. You're often given some examples of a and A and outputs f(a) and B. So you might be given some people in their test results, you might be given some years of the profit in your mission. Figure out the function, to figure out a trend, a pattern, some call trend analysis, pattern analysis. Not getting into the details, it's a really really big rabbit hole, but the whole field of supervised learning is literally about that. You're given examples of input output pairs, try to figure out the function.