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!

tivadar.gumroad.com/l/mathematics-…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Tivadar Danka

Tivadar Danka Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @TivadarDanka

8 Dec
Math Twitter!

I have an annoyingly simple problem that has been bugging me for years. It is about the 3-regular infinite tree graph with a root.

Can we collaboratively solve this problem? I'll explain below.

(Retweet so this reaches as many smart people as possible.) Image
The 3-regular infinite tree with a root (3RT) is very simple to define.

The root vertex has two children, and besides that, every vertex has two more. This goes on infinitely.

You get the pattern. This is illustrated below. Image
It is easy to see that 3RT is a planar graph; that is, you can draw it on the plane without any edges intersecting.

I am particularly interested in drawing the 3RT inside a bounded set of the plane without any edges intersecting.
Read 7 tweets
7 Dec
I was recently invited to join the Underfitted DAO.

By default, I am skeptical about crypto projects, so I had a LOT of questions.

After a long conversation with @haltakov and @svpino, I am convinced.

Here is why.

The best way to get experience and knowledge in machine learning is to build things.

If you build things, you should be compensated in proportion to the value you create.

In practice, this is often not the case. Not in open source, not in the industry.

What can change this?
Well, DAO-s have this potential. Of course, the concept may not live up to the expectations, but their fundamental idea holds a lot of promise.

In a DAO, contributions are rewarded with tokens. Decisions are made by voting, where all token-holders can participate.
Read 6 tweets
6 Dec
What is recursion?

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?

3/13
Read 13 tweets
19 Oct
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.

📺 Computer vision
🗣️ NLP
🎮 Reinforcement learning
🗄️ Data engineering
📊 Visualization
☁️ Deployment
A few thoughts before we start.

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.
Read 29 tweets
11 Oct
There is much more to machine learning than training models.

Most courses focus exclusively on this, but this is just a small part of the pipeline.

Here are the skills that will make you a true full stack machine learning engineer. ↓
1. git

Breaking things is an inevitable consequence of building. Once your projects become serious, smashing Ctrl + Z won't get you out of trouble anymore.

This is where version control comes into play, which is essential to learn. (Especially when working in teams.)
Learning git can seem difficult at first because of the extensive use of the command line.

To start, I recommend these interactive tutorials:

• Git Immersion (gitimmersion.com/index.html)
• Learn Git Branching (learngitbranching.js.org)
Read 22 tweets
8 Oct
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.
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(