矩阵乘法如何去逆矩阵_矩阵乘法和求逆
矩陣乘法如何去逆矩陣
數(shù)據(jù)科學與機器學習的線性代數(shù) (LINEAR ALGEBRA FOR DATA SCIENCE AND MACHINE LEARNING)
We are going to treat two of the most used calculations for matrices, multiplications, and inversion, let’s start with multiplication and how to do it in distinct ways.
我們將處理兩個最常用的矩陣,乘法和求逆計算,讓我們從乘法以及如何以不同的方式開始。
矩陣乘法 (Matrix Multiplication)
To be able to multiplicate matrices, their sizes have to be compatible, the number of rows of the first matrix has to match the number of columns of the second matrix.
為了能夠相乘矩陣,它們的大小必須兼容,第一矩陣的行數(shù)必須與第二矩陣的列數(shù)匹配。
We will run all the examples on the same two 2 by 2 matrixes:
我們將在相同的兩個2 x 2矩陣上運行所有示例:
Base matrices to run examples, self-generated.運行實例的基本矩陣,是自生成的。點積 (Dot product)
The first way to multiplicate them is by using the dot product, that is, multiplicate every row per every column and the index that matches between the two vectors is the position of the result, let’s calculate C = A B.
將它們相乘的第一種方法是使用點積,即將每列的每一行相乘,并且兩個向量之間匹配的索引是結(jié)果的位置,讓我們計算C = AB 。
Let’s explain how to calculate c11 and c12,
讓我們解釋一下如何計算c11和c12 ,
Dot product example, self-generated.點產(chǎn)品示例,自行生成。After calculating all the dot products, using the next mathematical expression, we get the C matrix.
在計算所有點積之后,使用下一個數(shù)學表達式,我們得到C矩陣。
Dot product formula, self-generated.點積配方,自行生成。 C result, self-generated.C結(jié)果,自我生成。向量乘法 (Vector multiplication)
As we’ve seen in the dot product, we are multiplying rows per columns, the dot product can be upgraded by using vector products, that have fastest computing times, so let’s think about matrix multiplications as vectors, where:
正如我們在點積中所看到的,我們在每列中增加行,可以使用具有最快計算時間的矢量積來升級點積,因此讓我們考慮將矩陣乘法作為矢量,其中:
The formula of vector product, self-generated.矢量積的公式,是自生成的。 Vector product examples, self-generated.矢量產(chǎn)品示例,自行生成。塊乘法 (Block multiplication)
This last strategy for multiplication is not intuitive, but it ends up doing the same multiplications and getting the same results, the strategy here is to divide the matrixes into compatible submatrices for the multiplication, for example, if you have two 10 by 10 matrix, you can divide it as 4 5 by 5 matrices and do the following:
最后一種乘法策略不直觀,但最終會進行相同的乘法并獲得相同的結(jié)果,此處的策略是將矩陣劃分為兼容的子矩陣進行乘法運算,例如,如果您有兩個10 x 10矩陣,您可以將其除以4 5除以5矩陣,然后執(zhí)行以下操作:
Block multiplication, self-generated.塊乘法,自生成。矩陣求逆 (Matrix inversion)
To be reversible, a matrix has to have the same number of rows and columns and there should be no linear combination in their rows or columns.
為了可逆,矩陣必須具有相同數(shù)量的行和列,并且其行或列中不應有線性組合。
To invert a matrix we use the following condition, which says that a matrix by the inverse of it we get the identity matrix. The identity matrix is the one that’s composed of 1 at the diagonal.
為了使矩陣求逆,我們使用以下條件,即通過逆矩陣可以得到單位矩陣。 單位矩陣是由對角線1組成的矩陣。
The easiest way to check if a matrix has no linear combinations and is invertible is calculate her determinant, if it’s 0, it’s not invertible.
檢查矩陣是否沒有線性組合并且是可逆的,最簡單的方法是計算其行列式,如果為0,則表示不可逆。
To calculate the inverse, the first idea becomes use the property:
要計算逆,首先要使用屬性:
A matrix by their inverse gives the identity, self-generated.通過它們的逆矩陣可以自我生成身份。So, we can obtain the inverse solving the equation system that we get when we multiplicate the matrices:
因此,當矩陣相乘時,我們可以獲得方程組的逆求解:
A matrix by their inverse gives the identity example, self-generated.由它們的逆矩陣給出了自我生成的身份示例。Instead of using this method, we can get the inverse using a better strategy, following the next steps:
代替使用此方法,我們可以按照以下步驟使用更好的策略獲得逆函數(shù):
- Create an augmented matrix adding the identity matrix a the right of A: 創(chuàng)建一個增強矩陣,在A的右邊添加單位矩陣:
- Use linear combinations to get the identity matrix at the left and the resulting right matrix will be the inverse of A: 使用線性組合在左側(cè)獲得恒等矩陣,而所得的右矩陣將為A的逆:
So, the inverse is:
因此,相反是:
Inverse matrix, self-generated.逆矩陣,自生。摘要 (Summary)
We learned how to multiplicate and invert matrices. This is the real basis of lineal algebra methods used in data science, on top of that, we will build the methods that all deep learning models use.
我們學習了如何對矩陣進行乘法和求逆。 這是數(shù)據(jù)科學中線性代數(shù)方法的真正基礎(chǔ),最重要的是,我們將構(gòu)建所??有深度學習模型都使用的方法。
This is the fifteenth post of my particular #100daysofML, I will be publishing the advances of this challenge at GitHub, Twitter, and Medium (Adrià Serra).
這是我特別#第十五后100daysofML,我會發(fā)布在GitHub上,Twitter和中型企業(yè)(這一挑戰(zhàn)的進步阿德里亞塞拉 )。
https://twitter.com/CrunchyML
https://twitter.com/CrunchyML
https://github.com/CrunchyPistacho/100DaysOfML
https://github.com/CrunchyPistacho/100DaysOfML
翻譯自: https://medium.com/ai-in-plain-english/matrix-multiplication-and-inversion-43f3922e74da
矩陣乘法如何去逆矩陣
總結(jié)
以上是生活随笔為你收集整理的矩阵乘法如何去逆矩阵_矩阵乘法和求逆的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 成龙新片《龙马精神》重新定档4月7日:吴
- 下一篇: 机器学习数据倾斜的解决方法_机器学习并不