Skip to main content

What is linear algebra for AI?

May 16, 2023. To learn more about the basic fields of mathematics relevant to machine learning, check out this Medium post by Wale Akinfaderin, The Mathematics of Machine Learning  

Akinfaderin published the post initially on his Lindked account in 2016. Although it's an "ancient" article by today's standards, where anything 5 weeks old can feel 5 years old, Akinfarerin's article is still relevant today. 

Akinfaderin keenly noted the nascent interest on machine learning, implicitly recognizing the potential growth for the field. By now, in May of 2023, it is evident that the interest in machine learning keeps increasing daily. Interest in machine learning is far from peaking yet. Machine learning is here to stay. Machine learning is a growing field. It is up to you to jump on it stay up to date on the playing field, or to retire to the sidelines. 

Momentum for everything AI is here. The AI industry it in its infancy. It will continue growing in the years and decades to come. Just as biological intelligence, AI has no limits or boundaries. Bookmark these words. As long as there is human life on the planet, there will be a vibrant market for AI. Just like computers and the internet, AI is now here forever.

Back in 2016, Akinfaderin noted that many AI enthusiasts lacked the basic mathematical background to understand the computational science behind machine learning. That was true then; it is true today; and will be true tomorrow. The more we learn, the more we need to continue learning. 

Every day humanity will have more exposure to AI and machine learning. The interest in the field will continue growing. More people will be interested in knowing more about AI and how machine learning works. Kids in elementary school today will be majoring in computer science 10 to 15 years from now. High school kids will do so within the next 4 years. Many college kids will pursue post graduate studies in machine learning. 

It is important to recognize the main fields or branches of mathematics involved in machine learning. The four basic fields of mathematics relevant to machine learning are: linear algebra; statistics; multivariable calculus; and algorithms.

LINEAR ALGEBRA

Let's take a quick look at basic concepts in linear algebra. Below we will simply scratch the surface on the topic. There is plenty more to study and learn. We will continue learning because its fun and gives us something to do. Learning beats the alternative. 

Linear algebra is a branch of mathematics that deals with the representations of linear equations using vectors and matrices. 

Mathematics is the study of quantities and shapes. There is an infinitum or endless set of things to study in life. When you are studying amounts and forms (quantities and shapes), you are studying mathematics. There are multiple branches of mathematics. More are being created. The continuum goes to infinity. So long as there is movement, there is transformation. Good luck trying to make things stop. Stillness is an illusion.

Vectors are lists of numbers. Plotted on graphs geometrically, vectors form arrows with represented magnitude and direction. Think of an arrow on a graph indicating with a starting point, a magnitude or length, and a direction. Vectors are lists of numbers represented geometrically by arrows.  

Matrices are linear transformations of vectors. Since vectors are represented numerically as just a list of numbers, whether in a row or a column, matrices are formed with rows and columns of vectors. Vectors are linearly transformed into matrices. 

Linear algebra is the addition, subtraction, and multiplication of linear equations represented by vectors and matrices. 

     Linear equations --> variables are not raised to any power other than one (1) and form straight lines when graphed. Visit Cuemath.com for more.

A linear equation is an algebraic equation where each variable has an exponent of 1, and when graphed always form a straight line. 

    An algebraic equation is a mathematical statement in which two expressions are defined as equal to each other. Check out byjus.com 

Linear equations are called linear because they form lines when graphed. To identify a linear equation just look at any algebraic equation. If any variable has an exponent other than number 1 (i.e. raised to the power of anything other than one), the equation is not linear.  

Common linear algebra operations on vectors are addition, subtraction, multiplication by a scalar (a real number). Multiplication of two vectors is accomplished by either the dot product or the cross product. [Check out Mathinsight for more about vectors.]

Linear algebra operations relevant to machine learning include all of the following: 

Principal Component Analysis (PCA). This is a mathematical method aimed at reducing the number of variables in a data set without significantly reducing the accuracy of the data set. Naturally, PCA is very helpful in managing big data sets for machine learning by reducing complexity without sacrificing utility. 

Singular Value Decomposition (SVD). Singular value decomposition is the simplification or factorization of a matrix into simple matrices to better understand data components. Since machine learning is all about processing big data sets to find patterns buried in the data, SVD simplification can help improve the efficiency of the process.   

Eigendecomposition of a matrix either by Lower-Upper (LU) decomposition or by QR decomposition. LU decomposition is factoring of a lower triangular matrix and an upper triangular matrix. QR decomposition is factoring a matrix that has independent columns as the product of a matrix with orthonormal columns (Q matrix or real square matrix with rows and columns that are orthonormal vectors) and a upper triangular matrix R. These eigendecompositions can help in performing matrix operations and in gathering facts about matrices that can facilitate the machine learning process.

Orthogonalization and Orthonormalization. Orthogonalization is the process of making vectors orthogonal. Orthogonal vectors are set of vectors that at right angles of each other (perpendicular to each other with a 90° angle between them) and their "dot product" is zero. The dot product (scalar product or inner product) coverts a vector coordinate set into a single number. It is obtained multiplying the Euclidean magnitude of the vectors and the cosine of the angle between them. The cosine of the angle between two orthonormal vectors is their dot product. Dot product is used for defining the "length" or magnitude of a vector. The length or magnitude of a vector is the sum of of the square root of the sum of the square of the vector components. The length is a "scalar", vector product in a three-dimensional space. Vector sets are orthonormal when all vectors are "normal" (i.e. have a length of one), and each vector pair in the set is orthogonal. Orthonormalization is "normalizing" vectors by changing them from non-unit vectors to "unit" vectors. Unit vectors are those with a length or magnitude of one.

Matrix Operations (addition, subtraction, and multiplication of matrices). 

Symmetric Matrix Covariance. A symmetric matrix is a square matrix that is equal to its transpose, and remains unchanged when the transpose is calculated. In machine learning many functions are symmetrical, making the corresponding matrices also symmetric. Symmetric matrices are useful in discovering "covariance" or joint variability of two random variables in data sets. In machine learning it is useful to measure the covariance of data points that could lead to the identification of patterns in data sets.  

Matrix Projection which is mapping vectors to subspaces. In statistics, the projection matrix (influence or hat matrix) correlates or maps vectors dependent variable values (response values) to the vectors of predicted (fitted) values  

Eigenvalues & Eigenvectors, which refer to non zero vectors that do not change their own direction in a transformation, but rather scale to their own characteristic values in the same direction. They do not change direction, but rather keep their own characteristic direction. Eigen is a German word meaning own or characteristic. 

Vector Spaces and Norms, which refers to using a function (called "norm") that associates vectors to their length on a vector space (also called "linear space" or set of vectors scaled (added or multiplied by numbers called "scalars"). 


Comments

Popular posts from this blog

When will the Tesla bubble burst?

December 11, 2024 When will the Tesla bubble burst?  We don't know Fools rush in. It's impossible to know exactly when the Tesla bubble will finally burst. Unfortunately for us at Creatix, we began shorting Tesla too soon. We are down almost 40% on our position as of today. We are not fooling ourselves thinking that we were ever make money on the short position. We truly doubt that Tesla can go down 40% any time soon.  We would love to add to the short position, but it would exceed our $3,000 limit on the stupid bets that we do for fun. We're not Mr. Beast. We have a very limited budget for ridiculousness. We would love to short Tesla tomorrow morning at the ridiculous share price of $424. Tesla is trading at an incredible 116 times earnings, which gives Tesla a market capitalization of $1.32 Trillion. Elon Musk added today $13.4 billion to his fortune. Yes, $13 billion in one day. Yesterday, he had added $11 billion. Yes, that's $24 billion in 2 days.  Six months ago, ...

Will prices go up or down during the Second Coming of Trump?

December 12, 2024 Will prices go up or down during the Second Coming of Trump? President-elect Donald Trump has acknowledged the difficulty of reducing grocery prices, stating, "It's hard to bring things down once they're up."  Lower Energy Costs and Better Logistics Trump hopes that lower energy costs and improved supply chains may prevent significant price increases on food. However, many economists believe that Trump's tariffs on foreign countries and massive deportation of illegal immigrants, which include millions of undocumented farm workers, will increase food prices.  Additionally, while Trump emphasizes the role that potentially lower energy prices may have in food costs, experts note that energy constitutes a relatively small portion of food production expenses. Energy prices may also increase despite experts forecasting that they will stay relatively low or go further down. After all, economists and financial experts are wrong often, almost all of the t...

Is there a Tesla bubble?

December 10, 2024 Is there a Tesla bubble? You bet. As of December 10, 2024, Tesla (Ticker: TSLA) is approaching an all-time high valuation, with a current share price of $401. The record closing price stands at $410, achieved on November 4, 2021. This gives the American electric car maker a market capitalization of $1.26 Trillion.  Tesla is trading at 110 times earnings. The average price to earnings ratio in the "traditional" automotive industry (excluding Tesla, and also excluding Chinese car makers) is about 6.7. That is, while almost all car makers in the world trade at 7 times earnings in average, Tesla is trading at 110, which is 15 times the industry average.  Major Automakers (Excluding Tesla and Chinese car makers) ranked by P/E: Subaru Corporation (Ticker: 7270.T): 12.0 Suzuki Motor Corporation (Ticker: 7269.T): 10.0 Toyota Motor Corporation (Ticker: TM): 9.70 Isuzu Motors Limited (Ticker: 7202.T): 9.0 Honda Motor Co., Ltd. (Ticker: HMC): 8.0 Mazda Motor Corporatio...