精品无人区无码乱码毛片国产_性做久久久久久免费观看_天堂中文在线资源_7777久久亚洲中文字幕

首頁(yè) 資訊正文

譯科技『連載』:從可視化線性代數(shù)開始機(jī)器學(xué)習(xí)(一)

  人工智能被廣泛應(yīng)用于圖像識(shí)別、語(yǔ)音識(shí)別、自然語(yǔ)言處理、智能推薦、自動(dòng)駕駛、智能制造、醫(yī)療保健等眾多領(lǐng)域,對(duì)社會(huì)、經(jīng)濟(jì)、科技的發(fā)展產(chǎn)生了深遠(yuǎn)影響。

  機(jī)器學(xué)習(xí)是人工智能的核心,是使計(jì)算機(jī)智能化的根本途徑。機(jī)器學(xué)習(xí)是一門多領(lǐng)域交叉學(xué)科,涉及多門學(xué)科,專門研究計(jì)算機(jī)怎樣模擬或?qū)崿F(xiàn)人類的學(xué)習(xí)行為,以獲取新的知識(shí)和技能,并重新組織已有知識(shí)結(jié)構(gòu)使之不斷提升自身性能。機(jī)器學(xué)習(xí)的發(fā)展已經(jīng)取得嘆為觀止的成就,徹底改變了人類對(duì)人工智能的認(rèn)知。想了解機(jī)器學(xué)習(xí),就需要先學(xué)習(xí)數(shù)學(xué)基礎(chǔ),包括線性代數(shù)、微積分、概率論等知識(shí),這些數(shù)學(xué)基礎(chǔ)對(duì)于深度學(xué)習(xí)等人工智能領(lǐng)域的理解至關(guān)重要。

  數(shù)據(jù)觀將從今日起連載《從可視化線性代數(shù)開始機(jī)器學(xué)習(xí)》系列文章,作者為歐洲航天局機(jī)器學(xué)習(xí)專家Marcello Politi,專業(yè)深度講述機(jī)器學(xué)習(xí)的“黑魔法”。

Visualized Linear Algebra to Get Started with Machine Learning: Part 1

從可視化線性代數(shù)開始機(jī)器學(xué)習(xí)(一)

  Master elements of linear algebra, start with simple and visual explanations of basic concepts.

  掌握線性代數(shù)要素,從基本概念的簡(jiǎn)明闡釋開始。

  Often the main difficulty one faces when one wants to begin one’s journey into the world of machine learning is having to understand math concepts. Sometimes this can be difficult if you do not have a solid background in subjects such as linear algebra, statistics, probability, optimization theory, or others.

  當(dāng)你剛剛踏入機(jī)器學(xué)習(xí)的世界,面臨的主要困難往往是數(shù)學(xué)概念的理解。如果沒(méi)有扎實(shí)的線性代數(shù)、統(tǒng)計(jì)學(xué)、概率論、優(yōu)化理論等學(xué)科背景,你通常難以往下走。

  In this article then, I would like to start by giving intuitive explanations of basic linear algebra concepts that are essential before delving into the world of Machine Learning. Obviously, this article is not meant to be exhaustive there is a lot to know about this subject, but maybe it can be a first approach to tackling this subject!

  本文而言,首先,我想對(duì)線性代數(shù)基礎(chǔ)概念進(jìn)行直觀解釋,這些概念有助于我們深入機(jī)器學(xué)習(xí)的世界。顯然,這篇文章并非詳盡無(wú)遺,關(guān)于機(jī)器學(xué)習(xí)和數(shù)學(xué)概念還有很多東西需要了解,但它可以成為解決這些問(wèn)題的第一種方法。

Introduction

簡(jiǎn)介

What is a vector?

什么是矢量?

Simple Vector Operations

簡(jiǎn)單向量運(yùn)算

Projections

投影

Basis, Vector Space and Linear Indipendence

基、矢量空間和線性無(wú)關(guān)

Matrices and Solving Equations

矩陣和求解方程

  Introduction

  簡(jiǎn)介

  Why Linear Algebra is important for Data Science?

  為什么線性代數(shù)對(duì)數(shù)據(jù)科學(xué)很重要?

  Linear algebra allows us to solve real-life problems, especially problems that are very common in data science.

  線性代數(shù)能夠解決我們現(xiàn)實(shí)生活中的問(wèn)題,尤其是數(shù)據(jù)科學(xué)中十分常見的問(wèn)題。

  Assume we go to the market to buy 3 avocados, and 4 broccoli and pay $8. The next day we buy 11 avocados and 2 broccoli and pay $12.Now we want to find out how much a single avocado and a single broccoli cost. We have to solve the following expressions simultaneously.

  假設(shè)我們?nèi)ナ袌?chǎng)購(gòu)買 3 個(gè)鱷梨和 4 個(gè)西蘭花,并支付 8 美元。第二天,我們買了 11 個(gè)鱷梨和 2 個(gè)西蘭花,并支付了 12 美元?,F(xiàn)在,我們想知道單個(gè)鱷梨和單個(gè)西蘭花的成本是多少,我們必須同時(shí)解決下列數(shù)學(xué)表達(dá)式。

Linear Algebra Problem (Image By Author)

線性代數(shù)問(wèn)題(圖片來(lái)自作者)

  Another typical problem is to find the best parameters of a function for it to fit the data we have collected. So suppose we already know what kind of function we need to use, but this function can change its form since it depends on some parameters. We want to find the best form and therefore the best parameters.

  另一個(gè)典型問(wèn)題是,找到一個(gè)函數(shù)的最佳參數(shù),使其適合我們收集的數(shù)據(jù)。因此,假設(shè)我們已經(jīng)知道需要使用什么樣的函數(shù),但這個(gè)函數(shù)可以改變其形式,因?yàn)樗蕾囉谝恍﹨?shù)。我們想找到最好的形式,從而找到最佳參數(shù)。

Fitting Data (Image By Author)

數(shù)據(jù)擬合(圖片來(lái)自作者)

  Let’s for example call μ = param1 and θ = param2.

  Usually, in Machine Learning, we want to iteratively update bot [μ, θ] to find at the end some good curve that fits our data.

  例如,我們調(diào)用μ = param1和θ = param2。

  通常,在機(jī)器學(xué)習(xí)中,我們希望迭代更新 bot [μ, θ]以在最后找到適合我們數(shù)據(jù)的良好曲線。

  Let’s say that a curve far away from the optimal green curve has a high error, while a curve similar to the green one has a low error. We usually say that we want to find those parameters [μ, θ] in order to minimize the error, so find the curve which is as closest as possible to the green one.

  比方說(shuō),離最佳綠色曲線較遠(yuǎn)的曲線有較高誤差,而與綠色曲線相似的曲線有較低誤差。我們通常說(shuō)要找到那些參數(shù)[μ, θ],使誤差最小化,所以要找到盡可能接近綠色曲線的其他曲線。

  Let’s see how linear algebra can help us with these problems!

  讓我們看看線性代數(shù)如何幫助我們解決這些問(wèn)題!

  What is a vector?

  什么是矢量?

  A vector in physics is a mathematical entity that has a direction a sign and a magnitude. So it is commonly represented visually with an arrow.

  物理學(xué)中的矢量是一個(gè)具有方向、符號(hào)和大小的數(shù)學(xué)實(shí)體。所以通常在用箭頭直觀表示。

Vector (Image By Author)

矢量(圖片來(lái)自作者)

  Often in computer science, the concept of vector is generalized. In fact, you will hear many times the term list instead of vector. In this conception, the vector is nothing more than a list of properties that we can use to represent anything.

  在計(jì)算機(jī)科學(xué)中,矢量的概念常常被泛化。事實(shí)上,你會(huì)多次聽到用“列表”代替“矢量”這個(gè)詞。在這種概念中,矢量不過(guò)是一個(gè)屬性列表,我們可以用它來(lái)表示任何東西。

  Suppose we want to represent houses according to 3 of their properties:

  假設(shè)我們要根據(jù)房屋的3個(gè)屬性來(lái)表示房屋:

  1. The number of rooms

  1. 房間數(shù)

  2. The number of bathrooms

  2. 衛(wèi)生間數(shù)

  3. Square meters

  3.平方米

 

Lists (Image By Author)

列表(圖片來(lái)自作者)

  For example, in the image above we have two vectors. The first represents a house with 4 bedrooms, 2 bathrooms and 85 square meters. The second, on the other hand, represents a house with 3 rooms, 1 bathroom and 60 square meters.

  例如,在上圖中我們有兩個(gè)矢量。第一個(gè)代表一個(gè)有4間臥室、2 間衛(wèi)生間和85平方米的房子;第二個(gè)代表一個(gè)有3個(gè)房間、1個(gè)衛(wèi)生間和60平方米的房子。

  Of course, if we are interested in other properties of the house we can create a much longer vector. In this case, we will say that the vector instead of having 3 dimensions will have n dimensions. In machine learning, we can often have hundreds or thousands of dimensions!

  當(dāng)然,如果對(duì)房子的其他屬性感興趣,可以創(chuàng)建一個(gè)更長(zhǎng)的矢量。在這種情況下,我們會(huì)說(shuō)矢量不是3維,而是N維。在機(jī)器學(xué)習(xí)中,通常可以有成百上千個(gè)維度。

  Simple Vector Operations

  簡(jiǎn)單矢量運(yùn)算

  There are operations we can perform with vectors, the simplest of which are certainly addition between two vectors, and multiplication of a vector by a scalar (i.e., a simple number).

  我們可以對(duì)矢量執(zhí)行一些操作,其中最簡(jiǎn)單的就是兩個(gè)矢量之間的加法,以及一個(gè)矢量與一個(gè)標(biāo)量(即一個(gè)簡(jiǎn)單的數(shù)字)的乘法。

  To add 2 vectors you can use the parallelogram rule. That is, you draw vectors parallel to those we want to add and then draw the diagonal. The diagonal will be the resulting vector of the addition. Believe me, it is much easier to understand this by looking directly at the following example.

  要添加2個(gè)矢量,可以使用平行四邊形規(guī)則。也就是說(shuō),繪制與要加的矢量平行的矢量,然后畫出對(duì)角線。對(duì)角線將是加法的結(jié)果矢量。直接看下面的例子會(huì)更容易理解這一點(diǎn)。

Vector Addition (Image By Author)

矢量加法(圖片來(lái)自作者)

  While multiplication by a scalar stretches the vector by n units. See the following example.

  而與標(biāo)量相乘則將矢量拉長(zhǎng)N個(gè)單位。請(qǐng)看下面的例子。

Vector -Scala Multiplication (Image By Author)

斯卡拉矢量乘法(圖片來(lái)自作者)

  Modulus and Inner Product

  模和內(nèi)積

  A vector is actually always expressed in terms of other vectors. For example, let us take as reference vectors, two vectors i and j both with length 1 and orthogonal to each other.

  一個(gè)矢量實(shí)際上總是用其他矢量表示。例如,我們把兩個(gè)長(zhǎng)度為1且相互正交的矢量i和j作為參考矢量。

Unit Lenght Vectors (Image By Author)

單位矢量(圖片來(lái)自作者)

  Now we define a new vector r, which starts from the origin, that is, from the point where i and j meet, and which is a times longer than i, and b times longer than j.

  現(xiàn)在我們定義一個(gè)新的矢量r,它從原點(diǎn)開始,即從i和j 的交點(diǎn)開始,比i長(zhǎng)a倍,比j 長(zhǎng)b倍。

A vector in Space (Image By Author)

空間矢量(圖片來(lái)自作者)

  More commonly we refer to a vector using its coordinates r = [a,b], in this way we can identify various vectors in a vector space.

  更常見的是,我們使用坐標(biāo) r = [a,b] 來(lái)引用矢量,這樣我們就可以在矢量空間中識(shí)別各種矢量。

  Now we are ready to define a new operation, the modulus of a vector, that is, its length can be derived from its coordinates and is defined as follows.

  現(xiàn)在我們準(zhǔn)備好定義一個(gè)新的操作,向量的模,即它的長(zhǎng)度可以從它的坐標(biāo)中導(dǎo)出,定義如下。

ector Modulus (Image by Author)

矢量模數(shù)(圖片來(lái)自作者)

  The Inner Product on the other hand is another operation with which given two vectors, it multiplies all their components and returns the sum.

  另一方面,內(nèi)積是另一種運(yùn)算,給定兩個(gè)矢量,它將它們的所有分量相乘并返回總和。

Inner (dot) Product (Image By Author)

內(nèi)(點(diǎn))積(圖片來(lái)自作者)

  The inner product has some properties that may be useful in some cases :

  內(nèi)積有一些特性,在某些情況下可能是有用的:

  commutative : r*s = s*r

  distributive over addition : r*(s*t) = r*s + r*t

  associative over scalar multiplication: r*(a*s) = a*(r*s) where a is a scalar

  Notice that if you compute the inner product of a vector per itself, you will get its modulus squared!

  交換律:r*s = s*r

  分配加法:r*(s*t) = r*s + r*t

  結(jié)合標(biāo)量乘法:r*(a*s) = a*(r*s) 其中 a 是標(biāo)量

  請(qǐng)注意,如果你計(jì)算一個(gè)矢量本身的內(nèi)積,你將得到它的模的平方!

  Inner (dot) Product (Image by Author)

內(nèi)(點(diǎn))積(圖片來(lái)自作者)

Cosine (dot) Product

  余弦(點(diǎn))積

  So far we have only seen a mathematical definition of the inner product based on the coordinates of vectors. Now let us see a geometric interpretation of it. Let us create 3 vectors r, s and their difference r-s, so as to form a triangle with 3 sides a,b,c.

  到目前為止,我們只看到了基于向量坐標(biāo)的內(nèi)積的數(shù)學(xué)定義。現(xiàn)在讓我們看看它的幾何解釋。創(chuàng)建 3 個(gè)向量r, s和它們的差r-s,形成一個(gè)有a,b,c 三條邊的三角形。

Triangle (Image By Autor)

三角形(圖片來(lái)自作者)

  We know from our high school days that we can derive c using a simple rule of trigonometry.

  我們從高中時(shí)代就知道,可以使用簡(jiǎn)單的三角法則推導(dǎo)出c。

Trigonometry (Image By Author)

三角學(xué)(圖片來(lái)自作者)

  But then we can derive from the above that:

  但是,也可以從上面得出:

(Image By Author)

(圖片來(lái)自作者)

  So the comprised angle has a strong effect on the result of this operation. In fact in some special cases where the angle is 0°, 90°, and 180° we will have that the cosine will be 0,1,-1 respectively. And so we will have special effects on this operation. So for example, 2 vectors that are 90 degrees to each other will always have a dot product = 0.

  所以?shī)A角對(duì)這個(gè)操作的結(jié)果有很大的影響。事實(shí)上,在角度為 0°、90° 和 180°的特殊情況下,余弦將分別為 0,1,-1,這將對(duì)此操作產(chǎn)生特殊效果。因此,例如,2個(gè)相互成90°的矢量總有一個(gè)點(diǎn)積=0。

  Projection

  投影

  Let’s consider two vectors r and s. These two vectors are close to each other from one side and make an angle θ in between them. Let’s put a torch on top of s, and we’ll see a shadow of s on r. That’s the projection of s on r.

  讓我們假設(shè)兩個(gè)矢量 r 和 s。這兩個(gè)矢量從一側(cè)彼此靠近并在它們之間形成角度θ,在s上放一個(gè)手電筒,我們會(huì)在r上看到s的影子。那是s在r上的投影。

Projection (Image By Author)

投影(圖片來(lái)自作者)

  There are 2 basics projection operations:

  有兩種基本的投影操作:

  Scalar Projection: gives us the magnitude of the projection

  標(biāo)量投影:投影的大小

  Vector Projections: gives us the projection vector itself

  矢量投影:投影矢量本身

Projections (Image By Author)

投影(圖片來(lái)自作者)

  Changing Basis

  變基

  Changing basis in linear algebra refers to the process of expressing a vector in a different set of coordinates, called a basis. A basis is a set of linearly independent vectors that can be used to express any vector in a vector space. When a vector is expressed on a different basis, its coordinates change.

  線性代數(shù)中的變基是指用一組不同的坐標(biāo)來(lái)表達(dá)一個(gè)向量的過(guò)程,這組坐標(biāo)稱為基。一個(gè)基是一組線性獨(dú)立的矢量,可以用來(lái)表達(dá)矢量空間中的任何矢量。當(dāng)一個(gè)矢量用不同的基來(lái)表達(dá)時(shí),它的坐標(biāo)就會(huì)改變。

  We have seen, for example, that in two dimensions each vector can be represented as a sum of two basis vectors [0,1] and [1,0]. These two vectors are the basis of our space. But can we use two other vectors as the basis and not just these two? Certainly but in this case the coordinates of each vector in our space will change. Let’s see how.

  例如,我們已經(jīng)看到,在二維空間中,每個(gè)矢量都可以表示為兩個(gè)基矢量 [0,1] 和 [1,0] 的和。這兩個(gè)矢量是我們空間的基礎(chǔ)。試想,可以使用其他兩個(gè)矢量作為基礎(chǔ)而不僅僅是這兩個(gè)嗎?當(dāng)然可以,但在這種情況下,空間中每個(gè)矢量坐標(biāo)都會(huì)發(fā)生變化。

New basis (Image by Author)

新基(圖片來(lái)自作者)

  In the image above, I have two bases. The base (e1, e2), and the base (b1,b2). In addition, I have a vector r (in red). This vector has coordinates [3,4] when expressed in terms of (e1,e2) which is the base we’ve always used by default. But how do its coordinates become when expressed in terms of (b1,b2)?

  在上面的圖片中,有兩個(gè)基數(shù)?;鶖?shù)(e1,e2),和基數(shù)(b1,b2)。此外,還有一個(gè)矢量r(紅色)。當(dāng)用(e1,e2)表示時(shí),這個(gè)向量的坐標(biāo)為[3,4],這是我們一直默認(rèn)使用的基數(shù)。但如果用(b1,b2)來(lái)表示,它的坐標(biāo)會(huì)變成什么樣子?

  To find these coordinates we need to go by steps. First, we need to find the projections of the vector r onto the vectors of the new base (b1,b2).

  為了找到這些坐標(biāo),我們需要分步驟進(jìn)行。首先,我們需要找到矢量r對(duì)新基點(diǎn)(b1,b2)的矢量的投影。

Changing Basis (Image By Author)

變基(圖片來(lái)自作者)

  It’s easy to see that the sum of these projections we created is just r.

  顯而易見我們創(chuàng)建的這些投影的總和就是 r。

  r = p1 + p2.

  Furthermore, in order to change the basis, I have to check that the new basis is also orthogonal, meaning that the vectors are at 90 degrees to each other, so they can define the whole space.

  此外,為了改變基礎(chǔ),我必須檢查新基也是正交的,也就是說(shuō),向量之間是90度的,所以它們可以定義整個(gè)空間。

  To check this just see if the cosine of the angle is 0 which means an angle of 90 degrees.

  要檢查這一點(diǎn),只需查看角度的余弦是否為 0,這意味著角度為 90 度。

Check orthonormal basis (Image by Author)

檢查正交基(圖片來(lái)自作者)

  Now we go on to calculate the vector projections of r on the vectors (b1,b2), with the formula we saw in the previous chapter.

  現(xiàn)在我們繼續(xù)計(jì)算 r 在矢量 (b1,b2) 上的矢量投影,使用我們?cè)谇耙徽绿岬降墓健?/strong>

Vector Projection (Image By Author)

矢量投影(圖片來(lái)自作者)

  The value circled in red in the vector projection will give us the coordinate of the new vector r expressed in base b : (b1,b2) instead of e : (e1,e2).

  矢量投影中用紅色圈出的值將為我們提供以基數(shù)b表示的新矢量r的坐標(biāo):(b1,b2) 而非e:(e1,e2)。

Vector r in new basis b (Image by Author)

新基b中的矢量r(圖片來(lái)自作者)

  To check that the calculations are right we need to check that the sum of the projections is just r in base e:(e1,e2).

  為了檢查計(jì)算是否正確,我們需要檢查投影的總和是否只是以e為基數(shù)的r:(e1,e2)。

  [4,2] + [-1,2] = [3,4]

  Basis, Vector Space and Linear Indipendence

  基、矢量空間和線性無(wú)關(guān)

  We have already seen and talked about basis. But let’s define more precisely what a vector basis is in a vector space.

  前面章節(jié)中,我們已經(jīng)看到并談到了基,接下來(lái)讓我們更加準(zhǔn)確地定義什么是矢量空間中的矢量基。

  A basis is a set of n vectors that:

  基是一組 n 個(gè)矢量,它們:

  are not linear combinations of each other (linearly independent)

  不是彼此的線性組合(線性獨(dú)立)

  span the space: the space is n-dimensional

  跨越空間:空間是n維的

  The first point means that if, for example, I have 3 vectors a,b,c forming a basis, that means there is no way to add these vectors together and multiply them by scalars and get zero!

  第一點(diǎn)是說(shuō),例如我有 3 個(gè)矢量a、b、c構(gòu)成一個(gè)基,這意味著沒(méi)有辦法將這些矢量加在一起并乘以標(biāo)量并得到零!

  If I denote by x y and z any three scalars (two numbers), it means that :

  如果我用x ,y和z表示任意三個(gè)標(biāo)量(兩個(gè)數(shù)字),則意味著:

  xa + yb +zc != 0

  (obviously excluding the trivial case where x = y = z = 0). In this case, we will say that the vectors are linearly independent.

  (顯然不包括 x = y = z = 0 的簡(jiǎn)單情況)。在這種情況下,我們會(huì)說(shuō)矢量是線性無(wú)關(guān)的。

  This means, for example, that there is no way to multiply by scalars and add a and b together to get c. It means that if a and b lie in space in two dimensions c lies in a third dimension instead.

  例如,無(wú)法乘以標(biāo)量并將a和b加在一起得到c。這意味著如果a和b位于二維空間中,則 c 位于第三維空間中。

  While the second point means that I can multiply these vectors by scalars and sum them together to get any possible vectors in a 3-dimensional space. So these 3 basis vectors are enough for me to define the whole space of dimension n=3.

  而第二點(diǎn)意味著我可以將這些矢量乘以標(biāo)量并將它們加在一起以獲得 3 維空間中的任何可能矢量。所以這 3 個(gè)基矢量足以讓我定義維度 n=3 的整個(gè)空間。

  Matrices and solving simultaneous equations

  矩陣和求解聯(lián)立方程

  By now you should be pretty good at handling vectors and doing operations with them. But what are they used for in real life? We saw in the beginning that one of our goals was to solve multiple equations together simultaneously, for example, to figure out the prices of vegetables at the supermarket.

  到目前為止,您應(yīng)該非常擅長(zhǎng)處理矢量并對(duì)它們進(jìn)行操作。但是它們?cè)诂F(xiàn)實(shí)生活中有什么用呢?我們一開始就知道我們的目標(biāo)之一是同時(shí)求解多個(gè)方程,例如,計(jì)算超市蔬菜的價(jià)格。

Simultaneous Equations (Image By Author)

聯(lián)立方程組(圖片來(lái)自作者)

  But now that we know the vectors we can rewrite these equations in a simpler way. We put the vectors of coefficients [2,10] and [3,1] next to each other in forming a matrix (set of vectors). Then we will have the vector of unknowns [a,b] and finally the result [8,3].

  但現(xiàn)在我們知道了矢量,我們可以用更簡(jiǎn)單的方式重寫這些方程。我們把系數(shù)向量[2,10]和[3,1]挨在一起,形成一個(gè)矩陣(矢量集)。然后我們會(huì)有未知數(shù)的矢量[a,b],最后是結(jié)果[8,3]。

Vectorized Form (Image By Author)

矢量化形式(圖片來(lái)自作者)

  Now you may ask whether this new form of writing the problem is really better or not. How do you do multiplication between a matrix and a vector? It is very simple. Just multiply each row of the matrix by the vector. In case we had a multiplication between two matrices we would have to multiply each row of the first matrix by each column of the second matrix.

  現(xiàn)在你可能會(huì)問(wèn),這種寫問(wèn)題的新形式是否真的更好。如何在矩陣和矢量之間做乘法?這很簡(jiǎn)單。只需將矩陣的每一行與矢量相乘。如果要在兩個(gè)矩陣之間做乘法,我們就必須用第一個(gè)矩陣的每一行乘以第二個(gè)矩陣的每一列。

  So by applying this rule rows by columns we should regain the original shape.

  因此,通過(guò)逐列應(yīng)用這一規(guī)則,我們應(yīng)該重新獲得原始形狀。

Matrix Multiplication (Image By Author)

矩陣乘法(圖片來(lái)自作者)

  This form, however, has other advantages as well. It gives us a geometric interpretation of what is happening. Every matrix defines a transformation in space. So if I have a point in a space and I apply a matrix, my point will move in some way.

  然而,這種形式也有其他優(yōu)點(diǎn)。它為我們提供了對(duì)正在發(fā)生的事情的幾何解釋。每個(gè)矩陣都定義了空間的轉(zhuǎn)換。因此,如果在一個(gè)空間里有一個(gè)點(diǎn),應(yīng)用一個(gè)矩陣,這個(gè)點(diǎn)將以某種方式移動(dòng)。

Matrix Transformation (Image By Author)

矩陣變換(圖片來(lái)自作者)

  But then we can also say that a matrix is nothing more than a function that takes a point as input and generates a new one as output.

  但是,我們也可以說(shuō),矩陣只不過(guò)是一個(gè)將一個(gè)點(diǎn)作為輸入并生成一個(gè)新點(diǎn)作為輸出的函數(shù)。

  So our initial problem can be interpreted as follows, “What is the original vector [a,b] on which the transformation results in [8,3]?”

  所以我們最初的問(wèn)題可以解釋如下:“什么是原始向量 [a,b],其變換結(jié)果為 [8,3]?”

  In this way, you can think about solving simultaneous equations as transformations over vectors in a vector space. Plus operations with matrices have the following properties that can be very useful.

  這樣一來(lái),就可以把求解聯(lián)立方程看成是對(duì)矢量空間中矢量的變換。矩陣加運(yùn)算具有以下非常有用的屬性。

  Given A(r) = r2 where A is a matrix and r, r2 are both scalar:

  給定 A(r) = r2,其中 A 是矩陣,r、r2 都是標(biāo)量:

  A(nr) = ns where n is a scalar

  A(nr) = ns其中n是標(biāo)量

  A(r+s) = A(r) + A(s) where s is a vector

  A(r+s) = A(r) + A(s)其中s是矢量

  Matrices and space transformations

  矩陣和空間變換

  To understand the effects of a matrix then we can see how they transform the vectors to which they are applied. In particular, we might see what is the impact of a matrix when applied on the eigenbasis.

  要了解矩陣的影響,可以了解它們?nèi)绾无D(zhuǎn)換應(yīng)用它們的矢量。特別是,我們可以看看矩陣在應(yīng)用于特征基數(shù)時(shí)有什么影響。

  If we have a 2x2 matrix and we are in a space in two dimensions, the first column of the matrix will tell us what the effect will be on the vector e1 = [1,0] and the second column instead will tell us what the effect will be on the vector e1 = [0,2].

  如果我們有一個(gè)2x2的矩陣,并且我們?cè)谝粋€(gè)二維空間中,矩陣的第一列會(huì)告訴我們對(duì)向量e1=[1,0]的影響,而第二列則會(huì)告訴我們對(duì)向量e1=[0,2]的影響。

  We then see the effect of some known matrices. These transformations are often useful in Machine Learning for data augmentation on images, you can stretch or shrink those images for example.

  然后我們看到一些已知矩陣的效果。這些變換在機(jī)器學(xué)習(xí)中對(duì)圖像的數(shù)據(jù)增強(qiáng)經(jīng)常是有用的,例如可以拉伸或縮小這些圖像。

Matrix transformations (Image By Author)

矩陣變換(圖片來(lái)自作者)

  We can also apply multiple consecutive transformations to a vector. So if we have two transformations represented by the matrices A1 and A2 we can apply them consecutively A2(A1(vector)).

  我們也可以對(duì)一個(gè)矢量連續(xù)進(jìn)行多次變換。因此,如果我們有兩個(gè)由矩陣A1和A2表示的變換,我們可以連續(xù)應(yīng)用它們A2(A1(vector))。

  But this is different from applying them inversely i.e. A1(A2(vector)). That is why the product between matrices does not enjoy the commutative property.

  但這與反過(guò)來(lái)應(yīng)用它們是不同的,即A1(A2(vector))。這就是為什么矩陣之間的乘積不享有換元特性的原因。

責(zé)任編輯:張薇

分享: