Today is #TheoryThursday 🧐!

I want to talk about what is, possibly, the most important question in all of Computer Science: Does P equal NP?

If you have heard of this and want to learn a bit more, read on... πŸ§΅πŸ‘‡
Computer Science is all about finding clever ways to solve difficult problems.

We have found clever algorithms for a bunch of them: sorting stuff, finding shortest paths, solving equations, simulating physics...

But some problems seem to be way too hard πŸ‘‡
One example is the Travelling Salesman problem.

❓ Find a cycle starting in your home city to visit all major cities in your country and return home with the least fuel cost.

This is the kind of problem we expect computers to solve easily, right? That's what computers are for!
πŸ™ˆ Well, very smart people have tried, and no one has come up with an algorithm that is always better than simply trying all possible cycles.

The problem is that the number of cycles grows exponentially faster than the number of cities!
Let's make it even easier, what about if I simply ask:

❓ Is it possible to visit all cities spending less than X dollars in fuel?

πŸ™ˆ No one still knows an algorithm to answer that question precisely for any value of X without trying all cycles, which again is exponential.
😬 So, are we simply dumb, or is this problem so complex that it is impossible to find a clever algorithm to solve it, in the general case?

This is the root of possibly the most important question in all of Computer Science: P vs NP.
Answering this question is way harder than it seems. You see, most questions in CS are about objects: how to sort, how to compare, how to process...

But this is a meta-question:

❓ Are there questions about objects that are intrinsically very hard to solve?
Stephen Cook tried to answer this question in the early days of Computer Science. He came up with the following definitions:

Suppose we have a question of the form:

❓ Is there an object X with a given property Q?

πŸ‘‰ We want to define how hard is this question to answer.
An example of an easy question of this type is the following:

❓ Given an array of N elements, is there an element smaller than X?

Answering this question is easy. Look at each element, one by one, and compare it with X. It takes at most N steps, for any possible array.
This is an example of a problem in P.

πŸ”‘ P here means "Polynomial-Time Complexity".

Intuitively, a problem is in P if there is an algorithm to compute a correct answer in polynomial time.
Now back to the Travelling Salesman, suppose I give you an answer:

πŸ‘‰ Yes, here, this is a cycle with cost less than X.

How can you verify that answer is correct? You just add the costs of all edges in the cycle. It takes again N steps.
This is an example of a problem in NP.

πŸ”‘ NP here means "Non-deterministic Polynomial-Time Complexity".

Intuitively, a problem is in NP if there is an algorithm to verify a correct answer in polynomial time.
P problems are easy to solve. NP problems, we don't know yet, but at least they are easy to verify. That's the key idea.

⚠️ Note that P problems are also NP.

Now, the P vs NP question, formally, is this:

❓ Are there problems in NP that are not in P?
P vs NP is basically asking if there are problems that are inherently harder to answer than to verify, independently of how smart we become in the future.

πŸ€” Think about what this means for a second, and ask yourself what's your intuition about it.
What's the right answer? We still don't know, but most computer scientists believe that P is not equal to NP.

The reasons are mostly philosophical but there is also evidence that, if P were equal to NP, a lot of weird things would happen.
This question is at the core of Computer Science because it talks about the nature of computation and its inherent limits, regardless of technological improvements.

We'll end here for now, but there is so much left to talk about (like NP-completeness).

So stick around πŸ‘‹...
As usual, if you like this topic, reply in this thread or @ me at any time. Feel free to ❀️ like and πŸ” retweet if you think someone else could benefit from knowing this stuff.

🧡 Read this thread online at apiad.net/tweetstorms/th…

β€’ β€’ β€’

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

Keep Current with Alejandro Piad Morffis

Alejandro Piad Morffis 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 @AlejandroPiad

3 Feb
There seems to be a recent surge in the "HTML is/isn't a programming language" discussion.

While there are a lot of honest misconceptions and also outright bullshit, I still think if we allow for some nuance there is a meaningful discussion to have about it.

My two cents πŸ‘‡
First, to be bluntly clear, if a person is using this argument to make a judgment of character, to imply that someone is lesser because of their knowledge (or lack of) about HTML or other skills of any nature, then that person is an asshole.

With that out the way...
Why is this discussion meaningful at all?

If you are newcomer to the dev world and you have some misconceptions about it, you can find yourself getting into compromises you're not yet ready for, or letting go options you could take.
Read 10 tweets
2 Feb
This is a Twitter series on #FoundationsOfML. Today, I want to talk about another fundamental question:

❓ What makes a metric useful for Machine Learning?

Let's take a look at some common evaluation metrics and their most important caveats... πŸ‘‡πŸ§΅
Remember our purpose is to find some optimal program P for solving a task T, by maximizing a performance metric M using some experience E.

We've already discussed different modeling paradigms and different types of experiences.

πŸ‘‰ But arguably, the most difficult design decision in any ML process is which evaluation metric(s) to use.
Read 25 tweets
31 Jan
One of the very interesting questions that really got me thinking yesterday (they all did to an important degree) was from @Jeande_d regarding how to balance between learning foundational/transferable skills vs focusing on specific tools.
@Jeande_d My reasoning was that one should try hard not to learn too much of a tool, because any tool will eventually disappear. But tools are crucial to be productive, so one should still learn enough to really take advantage of the unique features of that tool.
@Jeande_d One way I think you can try to hit that sweet spot is practice some sort of dropout regularization on your common tool set.

In every new project, substitute one of your usual tools for some convenient alternative. It will make you a bit less productive, to be sure...
Read 5 tweets
13 Jan
This is a Twitter series on #FoundationsOfML.

❓ Today, I want to start discussing the different types of Machine Learning flavors we can find.

This is a very high-level overview. In later threads, we'll dive deeper into each paradigm... πŸ‘‡πŸ§΅
Last time we talked about how Machine Learning works.

Basically, it's about having some source of experience E for solving a given task T, that allows us to find a program P which is (hopefully) optimal w.r.t. some metric M.

According to the nature of that experience, we can define different formulations, or flavors, of the learning process.

A useful distinction is whether we have an explicit goal or desired output, which gives rise to the definitions of 1️⃣ Supervised and 2️⃣ Unsupervised Learning πŸ‘‡
Read 18 tweets
12 Jan
A big problem with social and political sciences is that they *look* so intuitive and approachable that literally everyone has an opinion.

If I say "this is how quantum entanglement works" almost no one will dare to reply.

But if I say "this is how content moderation works"...
And the thing is, there is huge amount of actual, solid science on almost any socially relevant topic, and most of us are as uninformed in that as we are on any dark corner of particle physics.

We just believe we can have an opinion, because the topic seems less objective.
So we are paying a huge disrespect to social scientists, who have to deal every day with the false notion that what they have been researching for years is something that anyone, thinking for maybe five minutes, can weigh in. This is of course nonsense.
Read 5 tweets
12 Jan
I'm starting a Twitter series on #FoundationsOfML. Today, I want to answer this simple question.

❓ What is Machine Learning?

This is my preferred way of explaining it... πŸ‘‡πŸ§΅
Machine Learning is a computational approach to problem-solving with four key ingredients:

1️⃣ A task to solve T
2️⃣ A performance metric M
3️⃣ A computer program P
4️⃣ A source of experience E
You have a Machine Learning solution when:

πŸ”‘ The performance of program P at task T, as measured by M, improves with access to the experience E.

That's it.

Now let's unpack it with a simple example πŸ‘‡
Read 23 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 Become our Patreon

Thank you for your support!

Follow Us on Twitter!