Tivadar Danka Profile picture
Oct 5 16 tweets 5 min read Read on X
In calculus, going from a single variable to millions of variables is hard.

Understanding the three main types of functions helps make sense of multivariable calculus.

Surprisingly, they share a deep connection. Let's see why: Image
In general, a function assigns elements of one set to another.

This is too abstract for most engineering applications. Let's zoom in a little! Image
As our measurements are often real numbers, we prefer functions that operate on real vectors or scalars.

There are three categories:

1. vector-scalar,
2. vector-vector,
3. and scalar-vector. Image
When speaking about multivariable calculus, vector-scalar functions come to mind first.

Instead of a graph (like their single-variable counterparts), they define surfaces. Image
You can think about a vector-scalar function as a topographic map.

(Image source: Wikipedia, ) en.wikipedia.org/wiki/Terrain_c…Image
Although often not denoted, the argument of a vector-scalar function is always a vector.

Most frequently, we write out the components - a.k.a. the variables - explicitly. Image
Want a practical example of a vector-scalar function?

The loss of a predictive model maps the vector of parameters to a single scalar.

Below, you can see the mean-squared error of a simple linear regression model. Image
Next up, we have the vector-vector functions.

You can imagine them as a force field, putting a vector to each point. Image
The most important example of vector-vector functions is the gradient.

We call this a gradient field. Image
Let's visualize an example!

This is how the vector field given by the gradient of f(x, y) = x² + y² looks. Image
It is important to note that not all vector-vector functions are gradient fields!

For instance, f(x, y) = (x - xy, xy - y) cannot be a gradient.

Can you figure out the reason why? (Hint: take a look at the partial derivatives of f(x, y).) Image
Next up, we have scalar-vector functions, that is, curves.

Think about the scalar-vector function f(t) as the trajectory of a particle at time t.

Technically, there is only a single variable involved. Yet, curves play an essential role in multivariable calculus. Image
Remember how vector-vector functions define force fields?

Scalar-vector functions describe the trajectories of particles moving through them. Image
Gradient descent connects all of this.

In essence, gradient descent

1. takes the surface of the loss function,
2. computes the vector field given by the gradient,
3. and finds the trajectories given by the gradient vector field by a discrete approximation.
This is just the tip of the iceberg.

Multivariable calculus is one of the most powerful tools in machine learning, helping us to optimize functions in millions of variables.

That is quite a feat.
Most machine learning practitioners don’t understand the math behind their models.

That's why I've created a FREE roadmap so you can master the 3 main topics you'll ever need: algebra, calculus, and probabilities.

Get the roadmap here: thepalindrome.org/p/the-roadmap-…

• • •

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

Oct 4
The Law of Large Numbers is one of the most frequently misunderstood concepts of probability and statistics.

Just because you lost ten blackjack games in a row, it doesn’t mean that you’ll be more likely to be lucky next time.

What is the law of large numbers, then? Read on: Image
The strength of probability theory lies in its ability to translate complex random phenomena into coin tosses, dice rolls, and other simple experiments.

So, let’s stick with coin tossing.

What will the average number of heads be if we toss a coin, say, a thousand times?
To mathematically formalize this question, we’ll need random variables.

Tossing a fair coin is described by the Bernoulli distribution, so let X₁, X₂, … be such independent and identically distributed random variables. Image
Read 17 tweets
Oct 2
What is common between the Fourier series and the Cartesian coordinate system?

More than you think: they are (almost) the same.

I'll explain why: Image
Let's start with the basics: the inner product.

In the Euclidean plane, it can be calculated using the "magnitude x magnitude x cosine" formula, also known as the geometric definition. Image
Now, let's project x to y!

With basic trigonometry, we can see that the inner product is related to the length of the projection. Image
Read 14 tweets
Sep 26
Differentiation reveals much more than the slope of the tangent plane.

We like to think about it that way, but from a different angle, differentiation is the same as an approximation with a linear function. This allows us to greatly generalize the concept.

Let's see why! Image
By definition, the derivative of a function at the point 𝑎 is defined by the limit of the difference quotient, representing the rate of change. Image
In geometric terms, the differential quotient represents the slope of the line between two points of the function's graph. Image
Read 12 tweets
Sep 25
Understanding graph theory will seriously enhance your engineering skills; you must absolutely be familiar with them.

Here's a graph theory quickstart, in collaboration with @alepiad.

Read on: Image
What do the internet, your brain, the entire list of people you’ve ever met, and the city you live in have in common?

These are all radically different concepts, but they share a common trait.

They are all networks that establish relationships between objects. Image
As distinct as these things seem to be, they share common properties.

For example, the meaning of “distance” is different for

• Social networks
• Physical networks
• Information networks

But in all cases, there is a sense in which some objects are “close” or “far”. Image
Read 14 tweets
Sep 11
Logistic regression is one of the simplest models in machine learning, and one of the most revealing.

It shows how to move from geometric intuition to probabilistic reasoning. Mastering it sets the foundation for everything else.

Let’s dissect it step by step! Image
Let’s start with the most basic setup possible: one feature, two classes.

You’re predicting if a student passes or fails based on hours studied.

Your input x is a number, and your output y is either 0 or 1.

Let's build a predictive model! Image
We need a model that outputs values between 0 and 1.

Enter the sigmoid function: σ(ax + b).

If σ(ax + b) > 0.5, we predict pass (1).

Otherwise, fail (0).

It’s a clean way to represent uncertainty with math. Image
Read 15 tweets
Sep 8
Matrix multiplication is not easy to understand.

Even looking at the definition used to make me sweat, let alone trying to comprehend the pattern. Yet, there is a stunningly simple explanation behind it.

Let's pull back the curtain! Image
First, the raw definition.

This is how the product of A and B is given. Not the easiest (or most pleasant) to look at.

We are going to unwrap this. Image
Here is a quick visualization before the technical details.

The element in the i-th row and j-th column of AB is the dot product of A's i-th row and B's j-th column. Image
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

Don't want to be a Premium member but still want to support us?

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!

:(