DEV Community

Machine Learning Tech Stories
Machine Learning Tech Stories

Posted on • Updated on

How essential is Mathematics to Machine learning ?

( This is a placeholder for my learnings in the context of Mathematics for Machine Learning , updated almost daily, until I complete the course)

How does Mathematics play a very important role in Machine Learning ?

Mathematics topics such as Probability, Statistics, Linear Algebra, Calculus - are the basis for Machine Learning.

Linear Algebra Motivation

Solving Simultaneous linear equations

Suppose we have 2 variables - apples, bananas.
And we want to determine the prices of apples, bananas - given set of incidents.

First incident - it was - 2a + 3b = 13
Second incident - it was - 3a + 4b = 27

We go to market and buy apples and bananas and we want to solve the above equations, to determine the price of a, price of b.

The above problem can be formulated in terms of matrices and vectors.

| 2 3 | |a| = |13|
| 3 4 | |b| |27|

We have a 2x2 matrix, multiplied with a column vector, producing another column vector.

Optimization problem of fitting data with an equation with fitting parameters

Suppose we have an histogram of heights of people in a given region. Histogram means that, we have range of heights in x-axis of our graph and in y-axis, we have count of people who fall in that range. Now, with good amount of data, we have plotted an histogram. Now, we want to fit an equation or a line to this data. Basically, we want to find the optimal value of the parameters governing that particular equation/line which will fit the data.
The reason for fitting the line/ deriving the equation is that, we want to determine how the heights are distributed across people. Basically we also want to answer some questions, like: what is the average height of people in this region ? If we pick a random person from this region, what is the most likely height for this person ? We want to understand the distribution of the data. We have lot of data points, but, we want to understand the pattern, something like - there are very few people who are extremely tall. Most of the population in this region tend to have this height etc.

Another example to understand histogram is, distribution of night prices for airbnb houses , courtesy: (Yan Holtz) https://www.data-to-viz.com/graph/histogram.html

image

As I learnt from Yan Holtz's blog , the beauty of histogram is to understand the distribution of data primarily and that is evident visually from the following image, courtesy: Yan Holtz

image

We can see multiple types of distribution:
a. Skewed
b. Normal
c. Uniform - almost all ranges have equal amount of values.
d. Comb
e. edge peak
f. bimodal

With neural networks/ machine learning, there are 2 things to consider about fitting equation;
a. What is the mathematical equation which would fit this data?
b. How to best fit this equation - in the sense, what are the optimal values of the parameters of the equation, such that , this line representing the equation fits the data, in the best way possible.

Vectors in Linear Algebra

As we saw in the previous example of histogram, we want to fit an equation to the data representing the heights of people.
Then, let's consider a Gaussian distribution or a Normal distribution ( Normal means that, area under the curve is 1 ). In this equation, mu represents the center height of the curve. And sigma represents the width of the curve from the center. And it is represented by an equation shown below:

image
courtesy: imperial college, london - coursera

Learning continues....

Top comments (0)