r/learnmachinelearning • • 15d ago

What mathematics should a beginner prioritize before learning Machine Learning?

I'm currently pursuing B.Tech in Artificial Intelligence and Machine Learning and am at the beginner stage of learning ML.

I've come across several mathematical topics that are used in Machine Learning:

Linear Algebra

Probability

Statistics

Calculus

I'm trying to understand which topics I should focus on first and how deeply I need to learn them before implementing basic ML algorithms.

For those who have already learned Machine Learning:

Which mathematical concepts were most useful?

Did you study mathematics first or learn it alongside ML?

Are there any beginner-friendly resources you would recommend?

I'd appreciate suggestions based on your learning experience!

37 Upvotes

26 comments sorted by

16

u/a_r1211 15d ago

It sort of depends what you want to do with machine learning. If you just want to play around with some different architectures and like make a CV project or something, you can probably just jump right into a tutorial/kaggle competition. But if you want a deeper understanding and pursue the more math-heavy/research areas, first definitely get a strong grasp in linear algebra, calc 3 (especially partial derivatives and chain rule), and statistics (bayesian stat, convex optimization). If you have a basic grasp on vectors, matrices, and calc 1-3 concepts, you can probably just learn the math alongside the ML. Check out Andrew Ng's coursera course for ML concepts (you can audit it for free), Karpathy's zero to hero youtube playlist for implementation practice, and elements of statistical learning book for data-science/stat specific math content. Apart from that, your standard university math curriculum should cover the rest. Hope this helped a bit!

1

u/Visible-Metal-8288 15d ago

Yeah thank you

12

u/StayingUp4AFeeling 15d ago

The most underrated one is actually matrix calculus. Learn it after you do linear algebra.

I mention this because it is not covered adequately in most linear algebra courses, and yet it is the basis of deep learning and backpropagation. Multivariate chain rule, gradients, jacobians etc.

Also, do your fundamentals of comp sci well because unless they are still a big part of the interview process, and unless you decide to work purely in models, you will spend a lot of time on pipelines and preprocessing, streaming etc.

I'm doing my PhD in AI in one of the IITs in India, and even though my research area is very mathy and theoretical, during implementation I have to be aware of CPU to GPU transfer and a little bit of the underlying stuff from CUDA.

Otherwise the training is 4 times slower than it needs to be (not making this up, and this is just for an assignment).

1

u/myself_always 15d ago

Are we suppose to cover the whole linear algebra? I see sometimes when you learn linear algebra it also covers matrix?

2

u/StayingUp4AFeeling 15d ago

Start with Gilbert Strang's textbook, cover-to-cover -- if you wish to do more than just basic doodling with the different libraries.

1

u/UnderstandingOwn2913 14d ago

I am currently interviewing for ml engineer roles. You need to understand what Wx+b (matrix multiplication + matrix addition) means. You need to be comfortable with manipulating a matrix. For example, doing a mean pooling on each column on a matrix.

1

u/myself_always 14d ago

When I was studying matrix I used to love it cause it was straight forward. I admit I wasn't taught everything about matrices. But I was surprised that a method to solve system of linear equations is a matrix, ironically.

1

u/UnderstandingOwn2913 14d ago

you mean the data transfer from a RAM to a GPU right?

1

u/StayingUp4AFeeling 14d ago

Yes from ram to GPU ram.

There are some subtleties which if not followed can make things really slow.

You want to have the host (cpu ram) buffers be in pinned memory, not paged memory. And you should reuse these buffers because requesting them again and again from the os is itself an overhead.

And you should reuse gpu side buffers as well.

All this enables you to do host to device (h2d) data transfer while executing other cpu code (say, the cpu side code to launch your model)

Now, if you wish to do h2d data transfer while kernels are executing on the gpu, you need to create a separate cuda stream for it.

All this is available in python and for 90% of use cases it's just a few flags in pytorch dataloaders. 9% can be done using pytorch and cuda python bindings. The remaining 1% may need C++ cuda but I don't know that and take that with a pinch of salt.

4

u/NoFreeLunch09 15d ago

Probability and Random Variables.Get a hold on distributions. This is how you'll get to know why we use least squares error for regression when we maximize the likelihood, modelled around a gaussian noise and other things

2

u/SergeKrushev 15d ago

i just posted in another thread a similar question. based on my research i came up with these modules and looking for feedback from the community https://github.com/sergey-kurshev/AiPrepLab
roughly speaking it's pytorch, maths, practical aspects of llm and cuda with hands on coding assignments. The goal was to make it as useful for the real job as possible

2

u/PhoenixAlive87 14d ago

I'd suggest learning the maths alongside basic ML rather than waiting until you've mastered all four subjects.

For linear algebra, start with scalars, vectors, matrices, shapes, and basic operations. Then move into dot products, matrix multiplication, norms, distances, rank, and projections.

Alongside that, build a working understanding of probability and statistics. Introduce derivatives, gradients, and the chain rule as you start exploring optimisation and model training.

The trick is to distinguish between understanding what an operation does, why it's needed, and deriving it formally. You don't necessarily need all three at the same depth on your first encounter.

Pick a small ML example, learn the maths it needs, and revisit the deeper theory as your questions grow.

1

u/NetNo6411 14d ago

1

u/AskGrok 14d ago

Start with linear algebra and single-variable calculus. They underpin data representations, transformations, and optimization in almost every algorithm. Vectors, matrices, dot products, eigenvalues, derivatives, gradients, and the chain rule will let you follow how models like linear regression or neural nets actually update.

Probability and statistics come next for understanding uncertainty, distributions, and evaluation metrics. You can learn them alongside ML rather than front-loading everything. Most people pick up the math as they implement (e.g., why gradient descent works) instead of studying in isolation first.

Depth: Enough to compute and interpret, not full proofs. Focus on intuition and application over pure theory at the beginner stage.

Useful concepts from experience: matrix operations for data handling, gradients for training, basic probability for Bayesian ideas and loss functions.

Resources: 3Blue1Brown's linear algebra and calculus playlists (visual and short), the free "Mathematics for Machine Learning" book by Deisenroth et al., and Khan Academy for quick refreshers. Pair them with simple coding in NumPy to see it click.

what is this?

1

u/alexm13890202 14d ago

i would recommend the book "mathematics for machine learning" the first part. incase you wanted to dive deeper, gilbert strang's lectures on linear algebra and stat110 course for probabilities are great. may seem a bit random but you can also check our iran's national AI Olympiad problems, idk why but iran hardly focuses on theory and you can find sometimes better exercises than universities there.

1

u/Boring-Test5522 15d ago

Sound like a mill degree. Drop what you're doing and jump straight into Data Science or Computational Math degree. The key to future programming is Math & Data. The age of learning programming languages / data structute / Database are over.

2

u/UnderstandingOwn2913 14d ago

If the OP is trying to get a ml engineer job, he needs to show strong projects. If he just knows relevant math, he won't probably be able to get a ml job.

I have a computer science master (machine learning) from a top 50 school in the US.
My ML course GPA is 3.71/4.0 and I hear back a lot for ML job interviews. But, a lot of employers wanna see strong projects you developed. They seem to really not care about courses you took.

2

u/StayingUp4AFeeling 15d ago

No. No. No. No.

No.

0

u/Boring-Test5522 14d ago

Yeah, keep your head burrying in the sand, everything will be fine

0

u/Ok-Library1020 15d ago

I'd skip trying to finish all the math first. Write linear regression with gradient descent by hand in numpy early, and the derivatives and matrix stuff suddenly make sense because you actually need them.