Live data from Hacker News

Ask HN: What maths are critical to pursuing ML/AI?

news.ycombinator.com

71–80 of 139 posts

Re: Ask HN: What maths are critical to pursuing ML/AI?

#71
post #70

Part I (1) Calculus Generally should have college freshman and sophomore calculus. (1.1) Functions So, there can understand better what a function is. E.g., function f(x) = 3x^2 + 1. (1.2) Derivatives Then will learn how to find the slope of the graph of a function. That is the derivative of the function. E.g., for function f with f(x) = 3x + 2, as in high school algebra, the slope is 3. Then for each x, the derivati…

Part II

(2) Linear Algebra

(2.1) Linear Equations

The start of linear algebra was seen in high school algebra, solving systems of linear equations.

E.g., we seek numerical values of x and y so that

     3 x - 2 y = 7

     -x  + 2 y = 8
So, that is two equations in the two unknowns x and y.

Well, for positive integers m and n, we can have m linear (linear is in the above example but omitting here a careful definition) equations in n unknowns.

Then depending on the constants, there will be none, one, or infinitely many solutions.

E.g., likely the central technique of ML and data science is fitting a linear equation to data. There the central idea is the set of normal equations which are linear (and, crucially, symmetric and non-negative semi-definite as covered carefully in linear algebra).

(2.2) Gauss Elimination

The first technique for attacking linear equations is Gauss elimination. There can determine if there are none, one, or infinitely many solutions. For one solution, can find it. For infinitely many solutions can find one solution and for the rest characterize them as from arbitrary values of several of the variables.

(2.3) Vectors and Matrices

A nice step forward in working with systems of linear equations is the subject of vectors and matrices.

A good start is just

     3 x - 2 y = 7

     -x  + 2 y = 8
we saw above. What we do is just rip out the x and y, call that pair a vector, leave the constants on the left as a matrix, and regard the constants on the right side as another vector. Then the left side becomes the matrix theory product of the matrix of the constants and the vector of the unknowns x and y.

The matrix will have two rows and two columns written roughly as in

   /         \
   |  3  - 2 |
   |         |
   | -1    2 |
   \         /
So, this matrix is said to be 2 x 2 (2 by 2).

Sure, for positive integers m and n, we can have a matrix that is m x n (m by n) which means m rows and n columns.

The vector of the unknowns x and y is 2 x 1 and is written

   /   \
   | x |
   |   |
   | y |
   \   /
So, we can say that the matrix is A; the unknowns are the components of vector v; the right side is vector b; and that the system of equations is

     Av = b
where the Av is the matrix product of A and v. How is this product defined? It is defined to give us just what we had with the equations we started with -- here omitting a careful definition.

So, we use a matrix and two vectors as new notation to write our system of linear equations. That's the start of matrix theory.

It turns out that our new notation is another pillar of civilization.

Given a m x n matrix A and an n x p matrix B, we can form the m x p matrix product AB. Amazingly, this product is associative. That is, if we have p x q matrix C then we can form m x q product

ABC = (AB)C = A(BC)

It turns out this fact is profound and powerful.

The proof is based on interchanging the order two summation signs, and that fact generalizes.

Matrix product is the first good example of a linear operator in a linear system. The world is awash in linear systems. There is a lot on linear operators, e.g., Dunford and Schwartz, Linear Operators. Electronic engineering, acoustics, and quantum mechanics are awash in linear operators.

To build a model of the real world, for ML, AL, data science, ..., etc., the obvious first cut is to build a linear system.

And if one linear system does not fit very well, then we can use several in patches of some kind.

(2.4) Vector Spaces

For the set of real numbers R and a positive integer n, consider the set V of all n x 1 vectors of real numbers. Then V is a vector space. We can write out the definition of a vector space and see that the set V does satisfy that definition. That's the first vector space we get to consider.

But we encounter lots more vector spaces; e.g., in 3 dimensions, a 2 dimensional plane through the origin is also a vector space.

Gee, I mentioned dimension; we need a good definition and a lot of associated theorems. Linear algebra has those.

So, for matrix A, vector x, and vector of zeros 0, the set of all solutions x to

Ax = 0

is a vector space, and it and its dimension are central in what we get in many applications, e.g., at the end of Gauss elimination, fitting linear equations to data, etc.

(2.5) Eigen Values, Vectors

Eigen in German translates to English as special, unique, singular, or some such.

Well, for a n x n matrix A, we might have that

Ax = lx

for number l. In this case what matrix A does to vector x is just change its length by l and keep its direction the same. So, l and x are quite special. Then l is an eigenvalue of A, and x is a corresponding eigenvector of A.

These eigen quantities are central to the crucial singular value decomposition, the polar decomposition, principal components, etc.

(2.6) Texts

A good, now quite old, intermediate text in linear algebra is by Hoffman and Kunze, IIRC now available for free as PDF on the Internet.

A special, advanced linear algebra text is P. Halmos, Finite Dimensional Vector Spaces written in 1942 when Halmos was an assistant to John von Neumann at the Institute for Advanced Study. The text is an elegant finite dimensional introduction to infinite dimensional Hilbert space.

At

http://www.american.com/archive/2008/march-april-magazine-co...

is an entertaining article about Harvard's course Math 55. At one time that course used that book by Halmos and also, see below, Baby Rudin.

For more there is

Richard Bellman, Introduction to Matrix Analysis.

Horn and Johnson, Matrix Analysis.

There is much more, e.g., on numerical methods. There a good start is LINPACK, the software, associated documentation, and references.

(5) More

The next two topics would be probability theory and statistics.

For a first text in either of these two, I'd suggest you find several leading research universities, call their math departments, and find what texts they are using for their first courses in probability and statistics. I'd suggest you get the three most recommended texts, carefully study the most recommended one, and use the other two for reference.

Similarly for calculus and linear algebra.

For more, that would take us into a ugrad math major. Again, make some phone calls for a list of recommended texts. One of those might be

W. Rudin, Principles of Mathematical Analysis.

aka, "Baby Rudin". It's highly precise and challenging.

For more,

H. Royden, Real Analysis

W. Rudin, Real and Complex Analysis

L. Breiman, Probability

M. Loeve, Probability

J. Neveu, Mathematical Foundations of the Calculus of Probability

The last two are challenging.

For Bayesian, that's conditional expectation from the Radon-Nikodym theorem with a nice proof by John von Neumann in Rudin's Real and Complex Analysis.

After those texts, often can derive the main results of statistics on your own or just use Wikipedia a little. E.g., for the Neyman-Pearson result in statistical hypothesis testing, there is a nice proof from the Hahn decomposition from the Radon-Nikodym theorem.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#72

Surprising level of disagreement here on a few items for a sub field that has its own degree tracks. Multiavariable calc you either "abolsutely" need or don't really need. Should be well versed in graph theory, or don't need it much. Surely some of the contradiction is caused by different assumptions of what the goal is. But some of its hard to relate to as a reader. For example, I haven't been in the field but but h…

To apply known methods in cases where they mostly work, you don't need to know the math behind them, you just need to know basic stats and basic probability to interpret the results. So if the assumption is that you'll simply be solving your problems by applying the known methods using the (great!) tooling made by others, then you don't need the math background; you can certainly train undergrads to solve quite nifty problems with the powerful tools without going into much if any detail about the underlying math, treating it as an engineering problem of following best practices. After all, the choice of e.g. a particular gradient descent optimization algorithm is not based on their mathematical properties (the proven bounds are so far away from practical results, and a better proven bound doesn't correlate that much with having better results) but on empirical evaluation, and in most cases you're not going to implement any of the low-level structures/formulas on your own anyway, in practical solution development you're just going to choose them from a list by name in the framework of your choice.

On the other hand, if the assumption is that your particular problem is not solvable easily and reliably with the current approaches, then quite a lot of the math background helps - if you want to improve on the current results, or debug/understand why your solution doesn't work as intended, or why the conceptual solution can't work on your problem because of incompatible assumptions, then these areas of math are useful. If you want to use a new bleeding-edge construct, or a rare niche construct that's not yet implemented in the framework of your choice, then you're going to need to write it yourself, and then you need to understand how it works.

There's a large distance between using and applying ML techniques and researching and improving ML techniques; it's a continuum, but there's space for many people standing purely in the applied end.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#74
I won't really comment about ML/AI in general. But, if you specifically care about getting into Deep Learning, I would say only bother looking into: - Basic linear algebra and matrix algebra.

Since you would rely on frameworks like Tensorflow to handle figuring out the derivatives for you, you don't really need to know much calculus. Just read up on what derivative of a function at a particular point signifies. This should give you enough intuition to understand things initially.

A skill that would really come in useful would be ability to look at a function and think how increasing/decreasing one of the variables would affect it's value. This would help develop intuition around a lot of concepts used in Deep Learning topologies.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#75
post #20

You absolutely need a solid grounding in multi-variable calculus, linear algebra, probability theory and information theory. It will also be helpful to be well versed in graph theory. In my opinion one of the best starting points is "Information Theory, Inference and Learning Algorithms" by David MacKaye. It's a bit long in the tooth now, but it is still one of the most approachable and well written books in the fiel…

I'm not super interested in ML but I am very interested in applied mathematics in computer science. I've got a fair bit of linear algebra due to cryptography, but have had virtually no need of any form of calculus (unless I'm relying on it without knowing it) in my career. So beyond just saying that you'd need grounding in multivariable calculus to do serious ML work, I would be super interested in hearing more about…

I have a pretty good math background, but understanding K-L divergence ([0], a measure of the difference between two probability distributions) required revisiting some calculus. It's needed for understanding models with probabilistic output, used in both generative models and reinforcement learning.

[0] https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_diver...

Re: Ask HN: What maths are critical to pursuing ML/AI?

#76
For ML, the other users gave a good coverage of topics. But AI is an incredibly broad field, and each specialty uses different math topics. Learning all of the math would be infeasible. What are your particular interests?

Russell and Norvig have a good book at http://aima.cs.berkeley.edu that covers many different topics in AI, although it is definitely not comprehensive. I would say that whatever you learn in an undergraduate CS degree would give you a good starting point for learning any particular AI topics.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#77

You absolutely need a solid grounding in multi-variable calculus, linear algebra, probability theory and information theory. It will also be helpful to be well versed in graph theory. In my opinion one of the best starting points is "Information Theory, Inference and Learning Algorithms" by David MacKaye. It's a bit long in the tooth now, but it is still one of the most approachable and well written books in the fiel…

> "Bayesian Data Analysis" by Andrew Gelman is another great read. If you want to read that book you need real analysis more specifically measure theory (unless that subject is in probability theory for you). You cannot get into the last few chapters without it. Dirichlet Process are described using measures. I don't believe you need multivar calc or info theory. Info theory stuff are used but not as often. I believe…

What's required as a prereq to Measure Theory? Any suggestions on good resources for learning Measure Theory? I have a vague notion that Probability and Measure Theory are intertwined / related somehow, but have never studied the latter specifically.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#78
post #50

Not a mention so far about game theory or Nash equilibrium. I'm no expert but does anyone think these apply?

Not a mention so far about game theory or Nash equilibrium. It depends on what you're doing. I was literally just watching a video on Generative Adversarial Networks this morning, and game theory did come up there, at least in passing. If one sat down and started reading the papers on this subject and trying to implement / improve stuff in this area, I suspect game theory would be at least moderately important. There…

Interesting. Thanks.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#79
post #49

Earlier quoted context omitted.

What "maths" is keras? Or scikit-learn? For what it's worth, to understand scikit-learn doc/tutorial I'd say you'll need Probability, Linear Algebra, Multivariate Calculus and, yeah, Stats. Not necessarily at a PhD level but still. And more you understand maths farther you can get in AL/ML.

Those are ML and AI frameworks that use a tremendous amount of mathematics under the hood, but you can also reliably treat them as blackbox learning systems too. Understanding the model generation procedure and setup is often unneeded. And many tools will help direct you toward what algorithms makes the most sense for your data, and even have competitions to figure out which actually works best. I agree, it's a littl…

It's not just competition: a clear understanding of what happens under the hood will make you a better user of the tool.

Re: Ask HN: What maths are critical to pursuing ML/AI?

#80

Earlier quoted context omitted.

Can you recommend a Stats course that would be most relevant for people trying to be more practitioners (not researchers)?

Please just recommend the best online stats course you know of as a general toolbelt-notch.

There's a series of courses on Coursera, part of a Specialization from Duke titled something like "Statistics and Probability with R" or something like that. I've taken the first few classes in that series and have found them pretty good. The class on Bayesian Statistics is a little more difficult, but not too bad. I'll just say that you might want to complement the class with another book or other references on Bayesian stats. I've used this book:

https://www.amazon.com/Bayes-Rule-Tutorial-Introduction-Baye...

Post reply on HN