Just released a new chapter in the early access of my Mathematics of Machine Learning book!
It is about computing determinants in practice. Sadly, this is often missing from linear algebra courses, so I decided to fill this gap.
↓ Here's the gist. ↓
The determinant of a matrix is essentially the product of
• the orientation of its column vectors (which is either 1 or -1),
• and the area of the parallelepiped determined by them.
For 2x2 matrices, this is illustrated below.
Here is the thing.
In mathematics, we generally use two formulas to compute this quantity.
First, we have a sum that runs through all permutations of the columns.
This formula is hard to understand, let alone to implement.
The other one is not so good either.
It is a recursive formula, so implementing it is not that hard, but its performance is horrible.
Its complexity is O(n!), which is unfeasible in practice.
We can quickly implement this in Python.
However, it takes almost 30 seconds to calculate the determinant of a 10 x 10 matrix.
This is not going to cut it.
With a little trick, we can simplify this problem a lot.
If the determinant is not zero, we can factor any A into the product of a lower and an upper triangular matrix. This is called the LU decomposition.
As a bonus, the diagonal of L is constant 1.
The LU decomposition takes O(n³) steps to compute, and the determinant of A can be easily read out from it: determinants of triangular matrices equal to the product of the diagonal elements.
So, instead of O(n!), we can calculate determinants at O(n³) time.
The difference is stunning. With the recursive formula, a 10 x 10 determinant took 30 seconds. Using LU decomposition, we can do a 10000 x 10000 one in that time.
A bit of linear algebra can take us very far.
Having a deep understanding of mathematics will make you a better engineer. This is what I want to help you with.
If you are interested in the details and the beauties of linear algebra, check out the early access for my book!
A concise guide from zero to one. 100% knowledge, 0% fluff. 🠓
1/13
Functions, the central objects of mathematics and computer science, are just mappings of inputs to outputs.
A convenient (albeit quite imprecise) way to define them is to describe their effect. An explicit formula is often available, which we can translate to code.
2/13
However, giving an explicit formula is not always easy or possible.
For instance, can you calculate the number of ways we can order a deck of n cards by shuffling its cards?
The single best way to get into machine learning is to build something with it.
Here is an extensive list of hands-on projects that you can start right now. Take inspiration, learn tools, and find the topics you are passionate about.
Read on and go create something awesome. ↓
I am grouping the projects into the following categories.
These hands-on projects work the best when you
• follow along and do the coding as well,
• understand why and how things work,
• and try to bring what you built to the next level.
The reason PhD school is difficult is not because of the research.
Besides that, there are several key choices whose importance is underestimated by the students. Most of them are unrelated to your hard skills.
Here are the most impactful ones. ↓
1. Picking your advisor.
Young researchers usually value fame and prestige over personal relations. However, your advisor and your fellow labmates will determine your everyday work environment.
Don't sacrifice this for some scientific pedigree.
A healthy relationship with your advisor is essential for your professional performance. Pick someone who is not only a good scientist but a good person as well. Avoid abusive personalities.
Interview students and lab alumni about your prospective advisor if you can.