 Next up would be game theory to the rescue when hard decision are to be made So ladies and gentlemen, please welcome our next speaker like Sander handoff Probably wait until the talks finish, but thank you anyway Okay, I'm going to talk about game three obviously today. So Let me introduce yourself and myself. So in my day job. I develop and I consult so I'm Moving vertically through thing and I review technical solutions and we work on higher bringing high-tech startups Together with bigger companies if they have something that helps both companies. So that's what I'm doing the daytime if you have a challenging High-tech startup talk to me. Maybe we can help you And also I'm one of the organizers of the conference here program chairing I'm also active in the MongoDB community I'd like to talk and if you have any comments questions feel free to ping me on Twitter later Game theory We will only be able to stretch the surface of game theory Today, so there won't be no coding few last chance to leave now and I hope I can give you an idea about game theory because it's it's a little bit alive beyond if Else else if it's it's it's a glance into a different life a little bit I stumbled across using it just like by coincidence at the beginning of the year while actually the call for proposals were running and Yeah, people seem to like the idea unfortunately, so I mean game theory is Very human concept. It's not tech. It has a background in economics and philosophy and and I think you can imagine yourself like our world is getting much more hectic complicated so many options decisions and we are required to To make decisions all the time and sometimes this can be really difficult or stressful and And we very often worry did we do the right make the right choice? um Did I pick the right Pokemon to win the next? challenge So little knowledge of game theory can come really handy not only coding life solving some problems and Yeah, it's about making the best decisions you can but Probably not only best decisions for yourself Also of the best decisions for you and the people who surround you We'll step into that to that later. So Just think about how do you make decisions? How do you make judgments? Do you really note down like the pros and cons and wake them up? Some people do Some people don't they very much rely on their stomach as we say in Germany so Think about do your decisions affect others and Do you care about it? um and And that's supposed to be game theory is is going you have to anticipate the decisions that others Do while you're interacting with them and how they impact you and how your decisions impact the others and Yeah, this is basically like the basic idea of a game free and Actually, I stumbled across it For one client we were we're getting messy accounting data in from some very popular online platform for videos and We we can Check what the what's in there look like sometimes they just make match for some word stuff We don't really know and we try to account to the people who gave the video material or audio licenses and So if we could do it manually, but it's it's like really a lot a lot of data We would be like many people and not effective because we are it's a it's really a penny accounting business and So we also use like systems like for example like elastic search and we are the elastic search Who knows elastic search? Yeah, most of you so you know you can also like get a probability back on the quality or the results you get so how you get some indicator how Elastics are things how accurate to result us and so we have we have something to work with so but We have a like also like customized systems. We can look directly in the database. We have some some funny search stuff I don't want to go too deep in this but just like I was really stuck like in the combination of all okay I've all these expert systems. I can ask and Probably one expert system will improve my input and if I put it into me the other expert system I can even get better input and so I Was getting really confused like and So I thought what about game theory because I can't really use is else else is then To really solve it and so I remembered game theory and gave it a try on So let me introduce you a little more into game theory And I hope it will help you to make decisions and your coding or whatever Problems you're facing or like basically maybe just in your life or maybe even better in your life so game theory very often if you see a picture about game theory you will see chess and Yes, but it's actually a very bad example because it's game for you about playing games No, again, you can leave if you thought this is a game talk It's not about playing games it's about interactions between humans which we can also like Pretend it's it we can basically Imagine it's it's also like a game like simplified version of Interactions we can regard this as a game and we know games like chess or go or tic-tac-toe but They are that deterministic on every player knows at every stage of the game Everything you see you can see Everything basically it would be like playing poker with all cards on the table all the time and basically, it's just like You can calculate all possible results Yeah, of course, we don't because our brains are not capable and even computers are not capable of calculating all the results imaginable for all and for each and every move in in time so It's Imagine like game theory having all the cards on the table If the inform it the information is not not sorry It's not having all the cards on the table. Some information might be hidden and is there a way on to determine how you Still can Evaluate chances come make build up basically build up a strategy and basically this is what I was doing Then as a as an eight-year-old I believed I will win chess against the partner of my mother If I just chose the right color in the beginning After I lost many many games. I came to the conclusion. That's not the case. It's very unlikely but I Think like the average chess player is also trying to find a strategy and Anticipating what the next moves of your opponent might be although you can basically calculate each and every possible result You're anticipating what your player will do. You're anticipating his strategy and this Getting us a little bit closer to game theory and game theory was not just like invented um Overnight um, let's have a little glance into Game for your history. Oh, it was like first mentioned this goes back to the 1700s on Wargrave letters the guys from Britain, um, there's a French guy who Wrote a paper on a leading in the direction um and Then in the beginning of the 20th century things start to pick up with Zermolo Zermolo, um, über die Anwendung der Mengenlehre und die Theorie des Schachspiers Which actually can translate about how applying Set to your feet set theory in chess games then Then in the 19 Late 1920s The thing starts to really pick up with a paper from Hungarian Scientist John von Neumann. I think he moved to the US later and he wrote another paper to a theory leg is as of spiele, which is about like theory in board games and This paper got noticed a lot and in 1944 he published a book co-authored with Oscar Morgenstern theory of games and economic behavior and so we see already um The game for your thing is very close to economics and usually We think economic and people caring about economics. Oh, that's just a soft business. It's not like programming is much more better So um, we don't probably look into theories there And the the challenges is can we build up a mathematical model? Can we basically analyze or calculate results of of people's actions on the decisions the players might do and Basically, that's probably most famous thing in the 1950s It's like the prisoners dilemma dilemma and John Nash came up with the National Equilibrium And Yeah, it's very famous because like John Nash's life was a beautiful mind movie So he's very popular and by the way, this is a picture of John von Neumann. They're Hungarian scientists so background game theory is in economics political science and psychology Uses as well in logic computer science by largely with biology and poker Um, it's an a mathematical approach to real-life simulations There are situations that involve two or more decision-makers and Each decision-maker you for example Has a number of different actions they might take And the ultimate outcome does not just become depend on your actions It also depends on what the other people do So you are forced to think and come up with a strategy And this is basically so let's start with a really simple game this Something easy and practical. It's called zero sum game and the zero sum game is the winner takes it all and The other's game is the others lost and I'm really happy so many people and it's so crowded because I would like to play Two-finger Mora, so please partner with the one on your right Yeah, sorry, sorry, sorry, I thought you can go from lunch and have an app on sorry now So two finger Mora is a very simple game pick a partner and You basically Your child you have two choices show one finger or two finger and You have to decide who is the even player and who's the odd player and then just like as rock and scissors you Play with your partner and you show your fingers at the same time and if the result is Even even player wins and the result is odd or player wins. So you basically have 50-50 chance. So and you have five minutes, and I will be back once you have the results Yeah, oh you did a simulation Okay Five minutes was a joke. We're enjoying this Okay, we continue now It's good to hear you all have fun with I Didn't imagine this simple game would make you so lucky Okay, but basically What would be like a mathematical representation of what we were just like doing? that we call this like the strategic form and basically Yeah, that's like what we call the strategic form and So and this is also like the basis one can calculate on with like these matrices So, um, zero some games one winner one loser. It's a very competitive and this is a Another nice way. Um, it's called one zero some games it's more about synergy and everyone games on For example, like doing the same game in a little bit different form So let's do a non-zero same game, but please don't get as excited as Only 15 minutes left and I have to get you to prisoners dilemma is my goal So let's play a positive way of this thing. Um, let's do the same game, but Similar game, so if you show the same Counterfingers each of you gets two points and if it differs you only get one point and this is basically About more about cooperation You want to give it try? No, I think everybody can imagine So, um You have the idea so you can like interactions and this is like very simple interactions put into a matrix and we can work with that There's is there are games with perfect information as I mentioned chess go Tecto so everybody knows about everything and all the options and outcome for the other players and there are games with incomplete information basically life so Yeah, that's like the two and As next just like the classic game theory on thing is the prisoners dilemma So what is the prisoners dilemma? The prisoners dilemma imagine they're like two criminals They're already with the police the police has caught them and Imagine having them in two rooms in the police the strength In our police headquarters and they're being interrogated interrogated and the dilemma is Each of the two criminals does not know how the other criminal will decide so If you know if you cooperate, I mean if you ever have seen one of the US or Series they say if you cooperate or we can make a deal with the DA and Yeah, you can guard you will get free. Yeah, so the thing is that you know if you cooperate You might get free. You don't get any sentence but what if Your colleague your criminal colleague your co-operator conspirator also is cooperating Because then both are cooperating and it's not that all the criminals cooperating. They're just like saying yes We did it. We're so sorry and everybody will get free. Of course They will might they will both get a sentence a reduced sentence. Yeah on that and the other outcome Of course is just stay quiet and probably the police won't be able to prove anything or Probably open like only like a minor crime And then you might only end up with like a one-year sentence and This is the prisoners dilemma. We have And now let's get it into our strategic form so You're really screwed and you're really screwed you go to jail for 20 years and you don't want that and If you both keep quiet, we assume. Yeah, okay, we'll get some sentence, but not to the full crime You probably might only end up in prison for one year and how can you actually? Decide because there's two there's a dominant strategy what we call in game theory. It's a dominance So what what's always the best outcome you should choose and? actually confessing is because You either go to jail for one year or five years, but never for 20 years, so this is the best choice and And also confessing is only the only strong Nash equilibrium In the game and in the equilibrium is basically When there are no more gains for no one in being in the games so basically Nobody wants to take any action because he can no longer gain from it And this is of course in this simple game. This is just like a one round, but just like imagining There's more criminals involved like a gang of five and you have to think about over to the other four People decide on and it is a completely different game because probably There are a couple. They're very close and they won't never will give each other up But if it's just like some random guys you met on the street arm and you fought the gang to break in You might Tend to decide. Oh, that's better confessed because I don't trust those guys and also I don't want to be a part I can be apart from them, but you don't want to be apart from your Girlfriend or boyfriend for a time. So this is where things can get complicated and How can we calculate stuff like that? We can use algebra. There's many approaches Bayesian Nash Equilibrium we can do just like Monte Carlo city simulations to to get some results and Yeah, and there's some material you can look into There's a Python tool called gambit You can just play around with and think that there's a really nice blog post from a biologist Martin Jones at evolving strategies For an iterated prisoners dilemma tournament I think it's very descriptive with outcomes and everything. So I had really a lot of fun reading it while doing research for this talk and there's also From Stanford on cause there are a game three course from Matthew Jackson, which I think it's really good. I'm very well taught stuff and Yeah, I I hope I was able to give you a glance into Game theory a little bit different approach on thinking And yeah, I hope you had a good time and if there's time left. We can play some more to finger more Yeah, okay. Yeah, thank you. It's chance. Yes Hi, okay. So first, thank you very much for the talk. Can I ask you that you go back to the slide where you have the matrix? Yeah So Here it's very clear. I just pick up a little bit. I hardly can can hear you. Okay. Yeah so here I think it's very clear that the optimum for both if the Go is that they both serve minimum sentence is that they both keep quiet But you said that the Nash equilibrium is basically that if they both would confess Yeah, basically, let's like that. That's the best strategy is to confess why because there's no better strategy not Confessing but the thing is you can calculate like I mean, I don't understand certain drop you why you would prefer Being in prison for five years instead of one Sorry, I don't I don't understand why you would prefer being in prison for five years Instead of one. I mean, I know they have good food No, the thing is you don't know what the other one does that's the problem. You don't know what your partner decides on That's the whole trick of game. That's a thank you for the question. That's the key You don't know what the other party does Yeah, and so you make you need to make a decision on basically What's the best move, but you don't know? That's why that's why this is that's why this is the dominant strategy it minimizes your loss You will never go to prison for 20 years if you confess So like this place like the minimum is the maximum you can So basically if you would keep quiet, you would basically risk very higher penalty Yeah, basically if you can quiet, okay, that's a higher bet. I mean you if you know, it's yeah So first of all side note, I think it's interesting how people standing up and being very loud Kind of is the tragedy of the comments so another game theory concept But my question really is were you able to solve your data problems using game theory? I was yeah I was able to improve it Because like the thing is when when when do I end like like putting like the information Into the next system to improve it. So basically I didn't mention in a talk because it was a little deeper You can also define a threshold and if you know like the gain will be minimum And I think I remember it was like 5% or so so if we say we are we think the information is 95% accurate and After like also like a threshold of iterations, so it won't go on forever I mean if you just have one letter we might never we will never get a real result That's that that's the two things. Yeah, you can do the threshold easily you say like okay Percentage on probability or like iterations and then just like take the result as is it was very good for improving and interaction on multiple systems We have a few more questions. We don't have much time. So try to be short. Okay, this is done We have one question here Have you used the Python axle rod? No, no, I haven't used it, but I've seen it online during your reflux. Have you used it? It was developed by a friend of mine at Cardiff. Oh, yeah It's been very interesting in kind of raising interest in Python programmers in the in the dilemma, but I just wanted if you Had a strategy in the tournament No, actually like actually I was quite surprised because I thought when I when I Did research on When I was trying to solve the problem. I was doing I just thought okay Python game free area I expected like at least ten libraries and the result they were hardly any So it was quite surprised because usually there's a Python library for everything in life So yes It'd be great if we could pick up on the like helping and building stuff like that and also like Just like add game theory to our tool set of thinking when we're trying to solve problems because I know from like at least I feel being like Programming a lot You tend to think very deterministic. Yeah, this is the truth This is the end game fear opens up your mind to be a little bit more flexible finding a practical solution Very well, we are out of time. So let's thank the speaker