- Home
- Training Library
- Machine Learning
- Courses
- Module 2 - Maths for Machine Learning - Part Two

# Interpreting Data Structures from the Geometrical Perspective of Linear Algebra

## Contents

###### Maths for Machine Learning

## The course is part of this learning path

**Difficulty**Beginner

**Duration**1h 32m

**Students**78

**Ratings**

### Description

To design effective machine learning, you’ll need a firm grasp of the mathematics that support it. This course is part two of the module on maths for machine learning. It focuses on how to use linear regression in multiple dimensions, interpret data structures from the geometrical perspective of linear regression, and discuss how you can use vector subtraction. We’ll finish the course off by discussing how you can use visualized vectors to solve problems in machine learning, and how you can use matrices and multidimensional linear regression.

Part one of this module can be found here and provides an intro to the mathematics of machine learning, and then explores common functions and useful algebra for machine learning, the quadratic model, logarithms and exponents, linear regression, calculus, and notation.

If you have any feedback relating to this course, please contact us at support@cloudacademy.com.

### Transcript

In the mathematical view of Linear Algebra, or the more geometrical view of Linear Algebra, we have the same data structures, same operations, but we give them a slightly different interpretation. So let's talk about those interpretations and even why we would want to interpret them differently. So let's call this a mathematical view, mathematical, not even quite geometrical, even geometrical view. Now, the reason for adopting a geometrical view of anything, you know, whether we visualize points with a line like that, or we say, actually, the formula of this line is w.x, you know, or we spit it out in numbers, three times one plus , something times something, , all of these different views. One's a sort of calculative view, the other ones a kind of algebraic view. And then we've got this geometrical view. Why would we want each view? Well, the calculative view, is kind of how you perform the computation. It's necessary for actually computing a result, but it often disguises or hides the problem. So it's difficult to see what the problem is when you take the calculative view. Well, let's just say something a little bit about that. So, you might have this calculative, maybe even call it algorithmic or calculated view, this sort of hides problem. But it sort of shows working, all right. That's the key thing, it shows you how to work it out. Now the mathematical, algebraic view, which is this sort of, you know, w.x view, where you're sort of exposing the algebra of it doesn't tell you how to work it out. I mean the dot there doesn't tell you anything useful in itself, visually speaking, you have to sort of know how to calculate the dot. And there's lots of different ways of doing that, by the way. Okay, what is the algebraic view? It, it shows you the problem in a certain perspective. It sort of shows the problems, it shows the problem. You know, concisely sure. And what else does it do? It shows us the pieces of the problem, especially the pieces, and that's the key thing here with this algebraic view, you get to see which pieces are involved. So, if I have a model, and it's w.x, guess what? My problem is composed of a model of W and of X, and that's that, those are the only key pieces. What's the geometrical view for? That's the view we'll talk about now. And this is, it's what shows problem again, I'm really sure the piece is the problem is a sort of, it's not obvious that somehow that this weights here, because the weights on this one of course are the B and the A and you have to sort of draw those on. That's not really the visual. You're putting algebra back on there, right? So what are you getting with this visual? It's a different way of thinking, right. So this is a, it's a sort of different perspective on the problem. So it's a perspective, perspective on the problem and it's useful for coming up with how to solve it. It's a useful perspective, this visual perspective and is useful, sort of, to try and solve, it gives you some inspiration for techniques. So it's perspective on the problem and it's kind of inspiration for techniques, and gives you, maybe, an intuition, intuition for how a problem works. Okay, good. So, we've kind of, we've done the kind of calculation bit of this, we've began on the algebraic bit and we want to look at the geometrical bit now. We might talk a little bit more about the algebra as we go. So, right, in the geometrical picture, we've got X as a vector. Let's just have a vector of two components for column, column, well let's call em V and H. So, H would be this one, and V would be that one. C, Y H and V, and just a second. But Y, okay. So, what's in the geometrical picture? We draw, we visualize this vector. So, what we do is we go, well, here's H in the horizontal position, and here's V in the vertical position, and so this vector X is a vector. Well, let's just draw the point on first of all. There's the point H V, but a vector is understood not as a point, but as a motion towards the point. I may a draw a vector, you see. So it's understood, a vector is understood as a, really, as a pair of points, and the pair of points in Linear Algebra that we always choose is zero zero as the base, and then the components of the vector as the tip of the arrow. And then the motion is from the origin. This thing here is called the origin. From the origin toward the values of those of the H and V. So it's a movement towards those values. And the reason we, you know, the reason we think of it as an arrow is to do with how vector addition and vector subtraction works. So, when you look at how these things are added together and taken apart, they work much more like arrows than they do like points would, they wouldn't make sense as points. I'll show you why that is. So I've got H and V there. Let's go for different vectors. So there's going to be X1, let's call this X1. Let's go for X2. Let's not call it H and V again, let's call it P and Q. Let's do it in a different color, why not. Because, otherwise, you might get confused here. So, you see it in red. X2 is going to be P and Q. So, let's put P on. So, let's just draw it somewhere where we're not overlapping too much, there we go. So if we do, so P is gonna be the horizontal, Q is going to be the vertical component. And then the arrow will go towards this point here. So, let's draw the big tip . Now, okay, so there's we've got X4 over X1 there, and now we have X2. And then you can see, now, why we use this little ArrowAnnotation on the top. Some people would actually write out the full arrow, like that, I think it takes too long to write that, so I clip off the second part, but it's a little arrow. So, we've got X2 and we've got X1. Now let's add them together, let's add these together. So what are we gonna call the result? Let's call the result, I don't know, R for result, why not. And that will be X1 plus X2. What's that going to be? H plus B and Q plus V. Right, now, let's put some actual values in here, otherwise we're going to get a little confused. So, let's pose P is two, three and then H is gonna be four, and suppose Q is five and six, so we just pose five and then six. So, let's just put some numbers on here then. So, this is going to be X1 here is four, in the horizontal, and it's six in the vertical. X2 is going to be two in the horizontal and five in the vertical. And, so, the addition of both of those gonna be two plus four, which is six. Five and six is 11. Now, if I actually just draw that on, so you've got two, three, four, five, six in the vertical, that'll be five, six, that's two, three, four, five, six. And let's go for the vertical, so that's five, six, now I need to go all the way to eleven. So, we're gonna go five, six, seven, eight, nine, 10 11, that's gonna be 11. And, so, the vector to this one here is six, so I run up here let's draw in blue. It's gonna be zero zero. So, it might have a slightly different angle, cause I'm not sure how well these are drawing, they're not drawing so precisely but it will have, probably, a slight different angle. Let's say it's that vector there. Say that this a point. Now, the key thing about how this new one works, is it's, actually, visually speaking, all you need to do to get to this blue one is, actually, just put the red on the tip of the black, which is why I'm thinking the angles might be quite right. So, I can perform the same addition visually, just by taking this red arrow and moving it up the tip of the black arrow and then just drawing it, sort of, there like that. So all these should come to the same point, so we could either just use a bit of the eraser to do that. So, with vector addition, when we add the numbers this way, visually, it's working a lot more like directions work. In other words, if I tell you to travel along this way, and then I try to tell you to travel along that way, let's maybe say some of the way, then that way. If you'd actually follow both on a map, you'd go up, and then you would go along. And, so, it's actually a lot more like following a direction. So, the vector to this result would place here, so the vector here are just numbers A plus B, in that vector addition way. So, okay, good. So, that's interesting, now we're not considering this thing as a list of numbers, we're considering this as an arrow in some space, we can consider this thing here to be some kind of space. With an area and a geometry, and when we add these things together, we're thinking now not just what happened to the numbers, the calculative picture, we can this sense of motion along, which is quite a different picture, right, so it's much more visual way of understanding something. Now, the name of this space, by the way, is given a technical name called Feature Space, and that's just the coordinates of your feature vectors. So that's just, you know, if this were a film rating and the vertical one here was how much you spend on the ticket, then X2 would be a person who would spend two pounds on the ticket, and a rating of five for the film. And, you know, person one would have spent four pounds on the ticket and rated the film six. And is there any meaning adding two people together like this? Not necessarily, there doesn't have to be an actual meaning within the problem, but there could be, which is something like, you know, possibly if I go and watch a film, which costs four pounds, and then I watch a film that costs two pounds, what could my rating be? Well, maybe I spent six pounds and my rating is 11, so, probably, ratings don't work in addition terms like that, but maybe if the first one is a cost of a ticket and the second one is the cost of popcorn, then they would work that way. So, that would be ticket and if you make the second one here, the cost of the popcorn, then yeah, then when you have watched one film that cost four pounds, and you watch another which costs two pounds, if people are spending six pounds on popcorn one, then expectations they're maybe spending five on the other, and so you are getting six and 11 in the result. Okay, if these were coordinates in real physical space then this would just be a journey. So, you think of X1 as being a journey to the point four, six and X2 being the journey to two, five, and the then the total journey, resulting journey, is journey to six, 11. All right, so that's vector addition. So, what we've been talking about here is vector addition. So, I established first of all that we have this geometrical, sort of, arrow view. And, then now, we also have talked about addition in this geometrical.

### Lectures

Linear Regression in Multiple Dimensions - Vector Subtraction - Using Visualized Vectors to Solve Problems in Machine Learning - Matrices - Multidimensional Linear Regression Part 1 - Multidimensional Linear Regression Part 2 - Multidimensional Linear Regression Part 3

**Students**566

**Courses**9

Michael began programming as a young child, and after freelancing as a teenager, he joined and ran a web start-up during university. Around studying physics and after graduating, he worked as an IT contractor: first in telecoms in 2011 on a cloud digital transformation project; then variously as an interim CTO, Technical Project Manager, Technical Architect and Developer for agile start-ups and multinationals.

His academic work on Machine Learning and Quantum Computation furthered an interest he now pursues as QA's Principal Technologist for Machine Learning. Joining QA in 2015, he authors and teaches programmes on computer science, mathematics and artificial intelligence; and co-owns the data science curriculum at QA.