# Mathematics for AI/ML/DL, Operations Research/Management Science and Data Science

### - Overview

Mathematics is an important aspect of machine learning. While some people may absolutely love math, others may not. However, one must have at least some mathematical knowledge and understand the concepts of probability, statistics, and calculus to successfully solve machine learning tasks. You can't do anything without math. Everything around you is math. Everything around you is digital.

Driven by data, machine learning (ML) models are the mathematical engines of artificial intelligence, algorithmic expressions that can discover patterns and make predictions faster than humans. For the most transformative technological AI journey of our time, the engine you need is a machine learning model. For example, an ML model for computer vision might be able to identify cars and pedestrians in live video. A translatable word and sentence for natural language processing.

However, math can be daunting, especially for someone from a non-technical background. Apply this complexity to machine learning and you're in a very bad place. We can easily build models and perform various machine learning tasks using widely available libraries in Python and R. So it's easy to avoid the math part of the field.

The main branches of mathematics involved in artificial intelligence are: linear functions, linear graphics, linear algebra, probability, and statistics.

**- Machine Learning Model - The Mathematical Engines of AI**

A machine learning model is an expression of an algorithm that combs through large amounts of data to find patterns or make predictions. Driven by data, machine learning (ML) models are the mathematical engines of artificial intelligence.

Under the hood, a model is a mathematical representation of objects and their interrelationships. These objects can be anything from "likes" on social network posts to molecules in lab experiments.

Since there are no restrictions on what can be features of an ML model, there are no limits to what AI can be used for. Combinations are limitless. Data scientists have created a whole family of machine learning models for different uses, and many more are on the way.

**- ****Mathematics Behind AI**

The relationship between artificial intelligence (AI) and mathematics can be summarized as: "People who don't understand mathematics are like politicians who can't persuade. There is an unavoidable area for both. Work hard!"

All AI models are built using mathematical solutions and ideas. The purpose of artificial intelligence is to create models that can understand thinking. If you want to work in artificial intelligence: data scientist, machine learning engineer, robotics scientist, data analyst, natural language expert, deep learning scientist. You should focus on mathematical concepts.

The three main branches of mathematics that make up the boom in artificial intelligence are linear algebra, calculus, and probability. Linear algebra (LA), probability, and calculus are the "languages" in which machine learning (ML) is written. Studying these topics will provide a deeper understanding of the underlying algorithmic mechanisms and allow the development of new algorithms.

Probability and statistics are related fields of mathematics that focus on analyzing the relative frequency of events. Probability involves predicting the likelihood of future events, while statistics involves analyzing the frequency of past events.

Linear algebra (LA) is the foundational subject of mathematics and is extremely common in the physical sciences. It also forms the backbone of many machine learning algorithms. Therefore, understanding the core ideas is crucial for deep learning practitioners.

There is math behind every AI success.

**- Mathematics Behind Machine Learning and Deep Learning**

Many supervised machine learning and deep learning algorithms largely require tuning of model parameters to optimize the loss function. To do this, one needs to understand how the loss function changes as the model parameters change.

Machine learning (ML) and deep learning (DL) applications often deal with something called a cost function, objective function, or loss function. Typically, this function represents how well the model we create matches the data we use. Meaning, it gives us some sort of scalar value that tells us how much the model deviates. This value is used to optimize the parameters of the model and get better results on the next sample in the training set. For example, you can examine how the backpropagation algorithm updates the weights in a neural network based on this concept.

In order for our model to fit the data optimally, we must find the global minimum of the cost function. However, finding the global minimum and changing all these parameters is often very expensive and time consuming. This is why we use iterative optimization techniques like gradient descent.

Essentially, optimization is finding the extrema of some function, or more precisely, finding the minimum and maximum values. Also, when we are doing some kind of optimization, we always need to consider the values of the set of independent variables we are doing. This set of values is often referred to as the feasible set or feasible region. Mathematically speaking, it is always a subset of the set of real numbers X ⊆ R . The optimization problem is unconstrained if the feasible domain is the same as the domain of the function, for example, if X represents the complete set of possible values of the independent variable. Otherwise, it's limited and more difficult to solve.

**- Difference Between the Mathematics Behind Machine Learning and Data Science**

While data science and machine learning have a lot in common, there are nuances in their focus on mathematics.

Yes, there is a lot of overlap between data science and machine learning, but their main focus is quite different. In data science, the main goal is to explore and analyze data, generate hypotheses and test them. These are often steps to extract hidden inferences in the data that may not be observable at first glance. Therefore, we must rely strictly on the concepts of statistics and probability for comparison and hypothesis testing.

Machine learning, on the other hand, focuses more on the concept of linear algebra as it is the main stage where all complex processes take place (besides the efficiency aspect). On the other hand, multivariate calculus deals with the numerical optimization aspect, which is the driving force behind most machine learning algorithms.

Data science is often considered a prerequisite for machine learning. Think about it - we want the input data to a machine learning algorithm to be clean and ready for the technology we use. If you're one of those people who wants to work end-to-end (Data Science + Machine Learning), it's best to get yourself well-versed in the mathematical combination required for Data Science and Machine Learning.

**- Python vs R for AI, ML, and Data Science**

Python is a multi-paradigm programming language that can be described as dynamically typed, scripted, procedural, interpreted, and object-oriented. It comes with a very comprehensive built-in library called the standard library. Python's built-in power, power, and flexibility are great reasons to learn it.

Python is also versatile and can be used in everything from data science to system and network administration, building web applications, running utility scripts on your local computer, and more. Python has become a powerful language in the fields of data science, artificial intelligence, and machine learning. This is mainly due to the flexibility and community nature of the language, but it is also a direct result of producing many super-powerful, high-quality packages and modules. These packages are fully capable of performing tasks such as Exploratory Data Analysis (EDA), statistical analysis, predictive analysis, machine learning, artificial intelligence (neural networks and deep learning), recommender systems, and more.

Like Python, R is a multi-paradigm language that can be described as dynamically typed, scripted, procedural, and interpreted. R is considered a statistical software (similar to SAS and SPSS), very specialized and ideal for statistics, data analysis and data visualization. Therefore, it is not as flexible and diverse as Python's language. That said, due to its specialization, R has a large community who also specialize in these areas.

**- The Python Math Library**

The Python math library provides us with access to some common math functions and constants in Python that we can use throughout our code to perform more complex math calculations. The library is a built-in Python module, so you don't need any installation to use it. Here are some examples.

- import math
- math.pi
- math.exp(x)

**[More to come ...]**