天天看點

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

http://blog.csdn.net/pipisorry/article/details/43490965

機器學習Machine Learning - Andrew NG courses學習筆記

Linear Algebra Review線性代數複習

矩陣和向量及其表示介紹

what are matrices矩陣

matrix is just another way for saying, is a 2D or a two dimensional array.

dimension of the matrixis going to be written as the number of row times the number of columns in the matrix.

written out as R4 by 2 or concretely what people will sometimes say this matrix is an element of the set R 4 by 2.

matrix elements,(entries of matrix) the numbers inside the matrix.

the matrix gets you a way of letting you quickly organize, index and access lots of data.

what are vectors向量

A vector turns out to be a special case of a matrix.A vector is a matrix that has only 1 column so you have an N x 1 matrix.{本course中的vector都是列向量}

dimension:if have N equals four elements here.so we also call this is a four dimensional vector, just means that this is a vector with four elements, with four numbers in it.

refer to this as a vector in the set R4.

Notation關于符号的規範表示:

throughout the rest of these videos on linear algebra review, I will be using one index vectors.課程中大多向量下标都是從1開始。

when talking about machine learning applications, sometimes explicitly say when we need to switch to, when we need to use the zero index vectors as well.讨論機器學習應用時會轉換到下标從0開始。

Finally, by convention,use upper case to refer to matrices.So we're going to use capital letters like A, B, C.and usually we'll use lowercase,like a, b, x, y,to refer to either numbers,or just raw numbers or scalars or to vectors.

矩陣運算

Matrix Addition and Scalar Multiplication矩陣加法和标量乘法

Scalar Multiplication:multiply a matrix by a number

Matrix Vector Multiplication矩陣向量相乘

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

Example applying to the house price prediction

(theta0\1已經計算出來後,左邊是用matrix乘法同時預測多個house size對應的房價; 右邊是用for循環一個一個地計算)

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

矩陣計算的優勢

code on the left allows you to not only simplify the code,But, for subtle reasons,to be much more computationally efficient to make predictions on all of the prices of all of your houses doing it the way on the left than the way on the right than if you were to write your own formula.

matrix, matrix multiplication

重要性的展現:When we talk about the method in linear regression for how to solve for the parameters,theta zero and theta one, all in one shot.So, without needing an iterative algorithm like gradient descent.

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

Example:

have four houses whose prices we want to predict,but now we have three competing hypothesis.if you want to apply all 3 competing hypotheses to all four of the houses

(假設有3個不同的模型函數來預測4個house size對應的房價)

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

matrix multiplying的優勢

most popular programming languages will have great linear algebra libraries are highly optimized to do matrix matrix multiplication very efficiently, including taking advantage of any parallel computation that your computer may be capable of, when your computer has multiple calls or lots of multiple processors, within a processor sometimes there's there's parallelism as well called symdiparallelism [sp].

Matrix Multiplication Properties

not commutative 非交換律    

Associative 結合律

Identity Matrix機關矩陣

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

note:上面這個等式中I的次元是不同的,是以有時在matrix下面帶上下标。

Matrix Inverse and Transpose

matrix inverse矩陣的逆

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

note:only square matrices have inverses

the intuition if you want is that you can think of matrices as not have an inverse that is somehow too close to zero in some sense.

singular or degenerate matrix :(奇異或退化矩陣)

matrix that don't have an inverse Sometimes called a singular matrix or degenerate matrix.

zero zero zero matrix is an example of a matrix that is singular, or a matrix that is degenerate.

matrix transpose矩陣的轉置

Machine Learning - III. Linear Algebra Review線性代數 (Week 1, Optional)

from:http://blog.csdn.net/pipisorry/article/details/43490965

繼續閱讀