Algebra for Machine Learning
This article series will help an individual to start from being a beginner to becoming an Artificial Intelligence (AI) Engineer or a Data Scientist. Today, we start with basic algebra. Algebra plays an integral role on every mathematics that is a part of Artificial Intelligence and Data Science. Most novice enthusiasts have a perception that Artificial Intelligence is just programming, but it is much more than just coding. Elon Musk agreed in a Tweet, saying, “Machine Learning (a subset of Artificial Intelligence) Engineering is 10% Machine Learning and 90% Engineering.” And Mathematics is the heart and soul of any Engineering.
This series of articles will focus on Mathematics, statistics, probability calculations together with data science and machine learning pipelines. The articles will explain how to make you all the way from complete beginner to be able to build your own model.
Why do we care about Mathematics for AI and Machine Learning?
While choosing machine learning algorithms and predicting in the future, we have to find the trend about how data is distributed. One of the tools in ML is Linear Regression. To understand Linear Regression, we must understand Algebra first. In the scenario where there are data points all over the place, we need to find out the line which can describe a pattern. The way to find out that line would be Mathematics.
Branches of Mathematics to learn for AI and Machine Learning
Basic Algebra: Basics of Algebra covers the simple operation of mathematics like addition, subtraction, multiplication, and division involving both constant as well as variables. For example, x+50 = 100. It is one of the broadest areas of mathematics and its origin can be tracked back to the ages of ancient Babylonians which is over 1800 BCE.
Calculus
Calculus is a branch of mathematics that helps us understand changes between values that are related by a function. It is the mathematical study of continuous change. Tracing back its history, we can see how the Egyptian Moscow Papyrus has first got the inception of Calculus followed by Archimedes. Later, the Modern Calculus saw its uprising with the efforts of Gottfried Wilhelm Leibniz and Newton.
Linear Algebra
Linear algebra is the branch of mathematics concerning linear equations such as linear maps such as: and their representations in vector spaces and through matrices. It is the foundation upon which Artificial Intelligence operates.
Statistics
Statistics is a branch of mathematics that deals with data collection, interpretation, analysis, and presenting it to give an insight into what the data actually represents. Statistics can be applied to a wide range of fields from finance, healthcare, technology, demographics, business and so much more. With proper data, statistics can give a perspective about the details and views unseen and unrealizable to the average human. Statistics is the study and manipulation of data, including ways to gather, review, analyze, and draw conclusions from data.
Probabilities
Probability can be defined as the likeliness of something to occur or happen. Every time we need to explain what is the change of some outcome or an event to occur, we talk in terms of Probability. It is about calculating how likely or 'probable' something is to happen. The chance of an event happening can be described in words, for example 'certain', 'impossible' or 'likely'. In math, probabilities are always written as fractions, decimals or percentages with values between 0 and 1.
What will we need to learn in Algebra for AI?
Topic Covered in this article,
- Mathematical calculations and fun theories
- Sets and Intervals
- Algebraic Expression: Evaluating and Simplifying
- Algebraic Identities
- Equations and Functions
- Functions
You can be creative with mathematics. There isn’t just one way to solve it. Chinese method of solving multiplication calculates by counting the joints from left side first after drawing the lines. For e.g., 32 * 64, Draw 3 and 2 stick lines with some spaces vertically. And then draw, 6 lines and 4 with some spaces horizontally. After counting the joints from left to right, you’ll find the multiplication value.
Sets can be defined as a collection of numbers.
Set of even numbers: {…, -4, -2, 0, 2, 4, ---}
Set of odd numbers: {…, -3, -1, 1, 3, ...}
Set of prime numbers: {2, 3, 5, 7, 11, 13, 17}
Positive multiples of 3 that are less than 10: {3, 6, 9}
A = {3, 6, 9}
For e.g.,: When we have multiple sets, we can look for overlapping numbers.
LET US TAKE 3 SETS: A, B AND C
Arranging the sets with its elements, we have the following where,
Union of A and B. i.e., A U B = {1, 2, 4, 5, 7, 8}
Intersection of A and B. i.e., A ∩ B = {4, 7}
Intersection of A, B and C = {7}
7 is the overlapping element among all three sets, A, B, and C.
To get deeper into Algebra, Watch this complimentary video by AI 42,
An interval is a set that consists of all real numbers between a given pair of numbers.
For example - all the numbers between 1 and 6 are an interval.
For two intervals [1,5] and [3,6], [3,5] is the overlap between the intervals.
Algebraic expressions are made of terms, factors, and constants.
Terms in an algebraic expression are separated by addition operators, and factors are separated by multiplication operators.
Let us suppose an algebraic expression,
Here, 3 is a factor and 2 is constant.
Each X2, 3X, and 2 are terms.
Let us suppose an algebraic expression,
5x + 2y – xy + 5 –2y + x(3y - 1)
After removing the parenthesis we get,
= 5x + 2y – xy + 5 –2y +3xy –x
Combining like terms we get,
5x – x + 2y – 2y – xy + 3xy + 5
Algebraic identities are algebraic equations that are always true for every value of variables in them. Algebraic identities have their application in the factorization of polynomials. They contain variables and constants on both sides of the equation.
The solution above displays how the identities are formed into the following known identities.
Some of the commonly known Algebraic identities are as follows,
(a+b)^2 = a^2 + 2ab + b^2
(a - b)^2 = a^2 – 2ab + b^2
Equations and Functions are not the same things.
In algebra, an equation can be defined as a mathematical statement consisting of an equal symbol between two algebraic expressions that have the same value.
The most basic and common algebraic equations in math consist of one or more variables.
For instance, 2x + 3 = 15 is an equation, in which 2x + 3 and 15 are two expressions separated by an ‘equal’ sign.
A function is a binary relation between two sets that associates every element of the first set to exactly one element of the second set.
Functions were originally the idealization of how a varying quantity depends on another quantity. For example, the position of a planet is a function of time.
Since we can do transformations on functions it's extremely essential for AI. If the element on the first set goes to two elements on the second, it won’t be a function.
To summarize the transformation that happens to functions with the change in constant values, we have,
A function transformation takes whatever is the basic function f (x) and then "transforms" it (or "translates" it), which is a fancy way of saying that you change the formula a bit and thereby move the graph around.
Conclusion
You must learn linear algebra in order to be able to learn statistics. In order to be able to read and interpret statistics, you must learn the notation and operations of linear algebra. The results of some collaborations between the two fields are also stapled machine learning methods, such as the Principal Component Analysis, or PCA for short, used for data reduction.
As we are progressing in the direction of figuring out the line in the first diagram, looking into the data points, it may not be the line we are looking for precisely. Today, we’ve laid the foundation for understanding the different lines we have, build equations for them, and solve them with Algebra and we’ll build upon furthermore for complex algorithms in our next blog.