When it comes to computer science and especially to machine learning and data science, you oftentimes hear that mathematical skills are fundamental. But is this really true? And if yes, which areas of mathematics should one master? And why are they important in the first place?
Let me give you a quick answer, before I get into the details. If you just want to develop software or do some freelance web development, you don’t necessarily need a lot of higher math. To use frameworks like Django, Spring, Angular etc. and do build business applications, you won’t need complex theoretical understanding. However, if you are really interested in machine learning and you really want to master the subject, there is no way around a hell lot of math. Same goes for theoretical computer science. Wherever you need a lot of deep understanding and whenever you want to innovate or research in such a field, math is essential.
In this blog post we are going to talk about why exactly this is the case. Also we will take a look at how the individual skills are actually used in machine learning and computer science. So let’s get into it.
This one is probably the most important math field to master for machine learning. Now you might be confused if you have never programmed a machine learning algorithm yourself. If you have only used libraries like Scikit-Learn, Tensorflow or Keras, you don’t really see what is happening behind the scenes. Machine learning is actually nothing but math. Datasets? They are just matrices! The values you feed into your neural network? The neural network itself? Matrices, Vectors, Arrays! It is all the same. Literally everything that has to do with deep learning has to do with linear algebra. And even if you use libraries like NumPy or Pandas, you are constantly working with matrices and vectors.
For those of you who are not familiar with what linear algebra actually is, let me give you a very quick overview. Linear algebra is all about linear equations, linear systems, vectors and matrices. It is about how you do calculations with them and what they represent. It is a very theoretical field but its applications are quite practical. For example think about a convolutional neural network that recognizes different objects. The convolutional layers of this network work with filters. And what are these filters? They are matrices and the image we are working with is also a matrix of pixels. What the neural network does is, it calculates the dot product of the filter and a certain area of pixels, in order to create the channels. You probably start to realize why linear algebra might be important.
But its not only neural networks where this is relevant. In computer vision for example we are applying a lot of transformations, filters and effects onto our images. Everything here is done with matrices and vectors. It is essential to know what is happening in the background, even if you use libraries like Tensorflow or OpenCV. Because being a computer scientist is not about just calling functions. It is about understanding what is happening, getting an intuition about the algorithms and finding solutions to problems. Therefore the theory is essential.
Calculus & Optimization
Calculus is another field that is fundamental for computer science. Actually it is even more important when it comes to hardware programming, because there we work with frequencies and there calculus is used in many different ways. But for machine learning there is also a very big application of calculus and this is optimization. If you are into machine learning, you probably know about the gradient descent algorithm. It is the algorithm that minimizes the output of the loss function by tweaking the weights and biases. If you have read the sixth volume of The Python Bible series, which is about neural networks, you know that this algorithm consists of nothing but calculus. It is all about calculating the direction of steepest ascent and then going a tiny step into the opposite direction.
Another important reason to learn calculus is that it allows you to see how a function changes over time. When you are looking at sequential data like share prices this is very important. Again, if you are interested in really mastering machine learning, you need to know what is happening behind the scenes. This helps you with troubleshooting but also with innovation.
Statistics & Probability Theory
These two are probably the most obvious fields on this list I think. Actually you could say that machine learning and data science are just branches of statistics. For example linear regression or logistic regression are just statistical algorithms. Of course you can always implement everything without understanding statistics at all. But the problem is that then you are not at all aware of all the limitations and biases of the algorithms you are using. You have no clue which algorithm is the proper one for a given problem. It is easy to just use the algorithms but in order to solve problems, you need to know how an algorithm works and what it is suited for.
Probability theory is also essential for data science. This one is a bit tricky though. Oftentimes we are interested in the probability of a certain event happening. However the probability theory that we use in machine learning is more about how statistical algorithms work with probabilities. That is also the reason why these two are combined here. Algorithms like Naive Bayes for example are based on probability theory and statistics.
Last but not least let us get to a mathematical giant that actually really surprised me when I started studying computer science. I am talking about graph theory. I always liked graph theory because it was an interesting and visual way to apply math. But what I didn’t know is how much it is actually used in computer science. Things like algorithms, data structures and path finding algorithms all make use of graph theory.
In machine learning graph theory is extremely relevant because it provides a framework for working with interconnections. We are talking about things like links between websites, social networks etc. It is a good way to find ways to store and query our data in an efficient way. There are even graph databases which are used by companies like Facebook. Wherever you have a huge amount of data with lots of interconnections, graph theory will help you tremendously. It is an essential field for all of computer science.
All in all we can say that mathematics are essential for every computer scientist that is interested in more than just implementing, copying code and using libraries from other people. For everyone who wants to innovate, to understand and to build, I would totally recommend learning the fields mentioned in this post. You don’t necessarily need a college education to do that. With some discipline, some YouTube and some good books you can learn it by yourself.
I hope you enjoyed this blog post! If you want to tell me something or ask questions, feel free to ask in the comments! Down below you will find some additional links leading to more content. Check out my Instagram page or the other parts of this website, if you are interested in more! I also have a lot of high-quality Python programming books in the book section! Stay tuned!