Prisoner's Dilemma ๐Ÿค”

Time for some game theory! ๐Ÿ‘จโ€๐Ÿซ

Prisoner's Dilemma (PD) is an interesting game that explains how two rational individuals may make decisions that seem irrational.

The game has lots of examples and applications in real life!

Thread ๐Ÿ‘‡
There are different examples of PD, but this is the one I like most.

You want to buy something from another person. You exchange closed bags one containing the money and one the goods.

Both you and the other person can choose to honor the deal โœ… or to give an empty bag โŒ.
If you both honor the deal โœ… โœ… (cooperate), you both gain something.

If you both exchange empty bags โŒ โŒ (defect), at least nobody loses.

If you leave the bag empty, but get a full bag โœ… โŒ, you gain a lot, while the other person is screwed.

Image source: Wikipedia Image
The optimal move? ๐Ÿ’ฏ

If you play only ones, than the only rational move is to defect:

โ–ช๏ธ If the other side cooperates โœ…, it is better to defect โŒ, get the goods and keep the money.
โ–ช๏ธ If the other side defects โŒ, it is better to also give an empty bag โŒ to not lose money.
The dilemma ๐Ÿค”

But wait, if both people think in this way, the deal will never happen, right? This is obviously suboptimal, because you both actually want to do the dael!

Both sides individuallt act rationally, but the final result seems irrational - this is the dilemma!
Playing multiple times 1๏ธโƒฃ, 2๏ธโƒฃ, 3๏ธโƒฃ...

This changes if the game is played multiple times (Iterated Prisoner's Dilemma). Now, people actually start to cooperate more, even if the Nash euqilibrium of the system is still to always defect! People start acting superrationaly!
Both sides always cooperating is the optimal strategy, but it is not a stable state. One side will always have the incentive to screw the other side by defecting and increasing its gain in the short term.

IPD is a very interesting psyhological problem! ๐Ÿ˜€
Real world example - climate change โ˜€๏ธ

All contries agree that they have to cut CO2 emissions, because they need a stable climate. However, every country is hesitant to invest in measures to actually reduce CO2. It is better if everybody else reduces CO2 except you...
Real world example - doping ๐Ÿ’‰

If all atheltes are clean than they stay healthy an dcompete on a level playing field. When somebody starts doping they get an advantage. However, if everybody is doping, the advantage disappears, but everybody incurs the negative side effects.
Real world example - advertising ๐Ÿ’ฐ

If one of two competing companies starts advertizing, it will make some of the customers of the other company switch and gain an advantage. However, if both companies advertise a lot, they will both have high expenses without any gain.
Look around you and I'm sure you will find examples of Prisoner's Dilemma all around you. The question now is how to make the other person always wanting to cooperate? ๐Ÿ˜„

โ€ข โ€ข โ€ข

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

Keep Current with Vladimir Haltakov

Vladimir Haltakov 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 @haltakov

17 Feb
What are Convolutional Neural Networks? ๐Ÿž๏ธ โญ๏ธ โ›ฐ๏ธ

CNNs are an important class of deep artificial neural networks that are particularly well suited for images.

If you want to learn the important concepts of CNNs and understand why they work so well, this thread is for you!

๐Ÿงต๐Ÿ‘‡
What is a CNN? ๐Ÿค”

A CNN is a deep neural network that contains at least one convolutional layer. A typical CNN has a structure like this:
โ–ช๏ธ Image as input
โ–ช๏ธ Several convolutional layers
โ–ช๏ธ Several interleaved pooling layers
โ–ช๏ธ One/more fully connected layers

Example: AlexNet Image
A good example - AlexNet

Throughout the thread I will be giving examples based on AlexNet - this is the net architecture that arguably started the whole deep learning revolution in computer vision!

I've written more about AlexNet here:
Read 21 tweets
10 Feb
Dealing with imbalanced datasets ๐Ÿ โš–๏ธ ๐Ÿ˜

Real world datasets are often imbalanced - some of the classes appear much more often in your data than others.

The problem? You ML model will likely learn to only predict the dominant classes.

What can you do about it? ๐Ÿค”

Thread ๐Ÿ‘‡
Example ๐Ÿšฆ

We will be dealing with a ML model to detect traffic lights for a self-driving car ๐Ÿค–๐Ÿš—

Traffic lights are small so you will have much more parts of the image that are not traffic lights.

Furthermore, yellow lights ๐ŸŸก are much rarer than green ๐ŸŸข or red ๐Ÿ”ด.
The problem โšก

Imagine we train a model to classify the color of the traffic light. A typical distribution will be:
๐Ÿ”ด - 56%
๐ŸŸก - 3%
๐ŸŸข - 41%

So, your model can get to 97% accuracy just by learning to distinguish red from green.

How can we deal with this? ๐Ÿค”
Read 13 tweets
8 Feb
Machine Learning Formulas Explained ๐Ÿ‘จโ€๐Ÿซ

This is the formula for Mean Squared Error (MSE) as defined in WikiPedia. It represents a very simple concept, but may not be easy to read if you are just starting with ML.

Read below and it will be a piece of cake! ๐Ÿฐ

Thread ๐Ÿ‘‡
The core โšซ

Let's unpack from the inside out. MSE calculates how close are your model's predictions ลถ to the ground truth labels Y. You want the error to go to 0.

If you are predicting house prices, the error could be the difference between the predicted and the actual price.
Why squared? 2๏ธโƒฃ

Subtracting the prediction from the label won't work. The error may be negative or positive, which is a problem when summing up samples.

You can take the absolute value or the square of the error. The square has the property that it punished bigger errors more.
Read 8 tweets
28 Jan
Is this formula difficult? ๐Ÿค”

This is the formula for Gradient Descent with Momentum as presented in Wikipedia.

It may look intimidating at first, but I promise you that by the end of this thread it will be easy to understand!

Thread ๐Ÿ‘‡
The Basis โ—ป๏ธ

Let's break it down! The basis is this simple formula describing an iterative optimization method.

We have some weights (parameters) and we iteratively update them in some way to reach a goal.

Iterative methods are used when we cannot compute the solution directly
Gradient Decent Update ๐Ÿ“‰

We define a loss function describing how good our model is. We want to find the weights that minimize the loss (make the model better).

We compute the gradient of the loss and update the weights by a small amount (learning rate) against the gradient.
Read 7 tweets
27 Jan
How to add new classes to your ML model? ๐Ÿ๐ŸŽ๐ŸŠ... ๐ŸŒ?

You have a large multi-class NN in production.

You discover a new important class and want to add support for it *quickly* and with *low* risk.

Example: traffic signs recognition for self-driving cars ๐Ÿ›‘๐Ÿš—

Thread ๐Ÿ‘‡
The naive approach ๐Ÿคทโ€โ™‚๏ธ

Collect examples of the new class (for example a new traffic sign), label them and retrain the whole NN.

โœ… It will probably work

โŒ It will be time consuming, especially for big models.
โŒ Risk for unintended regressions
Freezing the first layers ๐Ÿฅถ

Typical CNNs learn generic image features in the initial layers and they will likely apply to the new sign as well.

You can freeze the weights of the initial layers and only retrain the last fully connected layer(s).
Read 10 tweets
26 Jan
Machine Learning Interview Question #7 ๐Ÿค–๐Ÿง ๐Ÿง

This is a more difficult and more open question...

โ“ You are developing a traffic signs detector for a self-driving car.

How would you design it in a way that you can quickly add support for new signs, you didn't see before โ“
๐ŸŒŸ BONUS QUESTION ๐ŸŒŸ:

Can you do this with minimal retrain of your neural network?
Looking forward to some creative answers! ๐Ÿ˜ƒ

Answer in the replies. Read the rules ๐Ÿ‘‡

Read 4 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!