+ 5
Assign probabilities to output in Python?
There are two teams in a soccer match. Team A has a 70 % probability of winning, a draw is 25 %, team B has a 5 % of the winning. How can you derive a score (e.g. 1:0) based on these probabilities? Assume that the goals are a random integer between 1 and 5.
13 Respuestas
+ 8
I tried a bit different approach, take a look:
https://code.sololearn.com/c9m4le17wggx/?ref=app
+ 5
It would depends on how many times you want to roll the dice in a specific match. 😉
The problem a little bit vague as you can always assign the winning team with any score as long as it's at least one more than the opposing team.
+ 5
tamaslud It is because the odds provided in the task concerned the ultimate result only. It is not the chance of striking a goal in a match, but of winning the match.
Theoretically, to be 100% correct with the task, we could first determine the winner (or a draw) with the set 0.70/0.05/0.20 probability and then randomly pick the result from all possible ones: (0:0, 1:1, 2:2,... 5:5) for draws, (1:0, 2:0, 3:0,... 5:3, 5:4) for A and (0:1, 0:2,... 3:5, 4:5) for B.
Still, the task is too vague about the match results, to determine whether it is a good approach.
+ 5
Johannes Thanks! I also felt it as being a more real-life example than going "backwards" from the result to the score :)
+ 3
Johannes They should hover around 0.70/0.05/0.25, respectively. The task is too vaguely coined to be able to solve it in only one way, as it leaves a lot of space for interpretation :)
+ 2
i think you also need the probability of a particular amount of goals per match. e.g. 100% is the probability of a draw. it can be either 0:0 or 30:30 if the number of goals are not determinated some way
+ 2
Kuba Siekierzyński - getting there :) Next step will be determining the odds from relative team strength. It's really a fun project.
https://code.sololearn.com/cjNkd8F0FSVB/?ref=app
+ 2
It's done! The probability part works :)
https://code.sololearn.com/cjNkd8F0FSVB/?ref=app
+ 1
Kuba Siekierzyński - this is a very interesting approach. Thanks!
+ 1
Kuba Siekierzyński - from glancing over it, it seems that the %es of the crown outcomes are also curved around the preset odds. But at what probability, I ask :)
+ 1
Kuba Siekierzyński in your code it is 0.72/0.12/0.16 but the result is ok. how it happens?
+ 1
Kuba Siekierzyński -still, I really think your approach is very good and usable. Thanks a lot for all the help and great input!
+ 1
Kuba Siekierzyński - and I much prefer it to the other, theoretically more correct one. Makes more sense for a soccer game :)