Rarity of unique combination with unequal probabilities

raxfax

New member
Joined
Sep 11, 2021
Messages
2
I am working on a personal project where a user can generate various unique combinations of images in a program.

There are 3 layers, one is the background, the second is a character layer, and the last one is an accessory layer. There are 5 different backgrounds, 29 different characters, and 11 different accessories. When the user inputs the total number of images to generate, the program will take one random background, character, and accessory and composite a new image out of them. Each background image, character image, and accessory image have different weights (or one image is more likely to be used in the composition than the other) for example a blue background has a weight of 10, a green one 20, yellow 50, etc.

My question is, how would you work out the rarity of a composition having a specific combination of images. Say a blue background, a zombie character, and a hat accessory. The blue background having a weight of 10, the zombie having a weight of 5, and the hat having a weight of 10. How rare would that combination be? (For example, that combination has a 3% rarity or 3 in 100 chance of being generated)

The solution I have come up with is as follows:

Sum all the weights together, divide it by 300 (because the maximum weight is 100, and there are 3 different layers so 3*100)
Take the answer and multiply it by 100 to get the percentage.

10+5+10 = 25
25/300 = 0.083
0.083*100 = 8.3%

(The combination has an 8.3% or 8 in 100 chance of being generated)

Is this solution correct?
 
I am working on a personal project where a user can generate various unique combinations of images in a program.

There are 3 layers, one is the background, the second is a character layer, and the last one is an accessory layer. There are 5 different backgrounds, 29 different characters, and 11 different accessories. When the user inputs the total number of images to generate, the program will take one random background, character, and accessory and composite a new image out of them. Each background image, character image, and accessory image have different weights (or one image is more likely to be used in the composition than the other) for example a blue background has a weight of 10, a green one 20, yellow 50, etc.

My question is, how would you work out the rarity of a composition having a specific combination of images. Say a blue background, a zombie character, and a hat accessory. The blue background having a weight of 10, the zombie having a weight of 5, and the hat having a weight of 10. How rare would that combination be? (For example, that combination has a 3% rarity or 3 in 100 chance of being generated)

The solution I have come up with is as follows:

Sum all the weights together, divide it by 300 (because the maximum weight is 100, and there are 3 different layers so 3*100)
Take the answer and multiply it by 100 to get the percentage.

10+5+10 = 25
25/300 = 0.083
0.083*100 = 8.3%

(The combination has an 8.3% or 8 in 100 chance of being generated)

Is this solution correct?
No, adding is inappropriate.

Can we assume that the weights in each category add up to 100, so that, e.g., blue background has probability 10/100 = 0.10?

Then find these probabilities for each layer, and multiply them. (This gives the probably of this and this and this, where the three events are independent.)

In your example, this would be (10/100)(5/100)(10/100) = .10*.05*.10 = 0.0005 = 0.05%.
 
No, adding is inappropriate.

Can we assume that the weights in each category add up to 100, so that, e.g., blue background has probability 10/100 = 0.10?

Then find these probabilities for each layer, and multiply them. (This gives the probably of this and this and this, where the three events are independent.)

In your example, this would be (10/100)(5/100)(10/100) = .10*.05*.10 = 0.0005 = 0.05%.
That does make a lot more sense, thanks for the answer!

I assume your solution would still be viable if each layer's weight does not add up to 100 (However it's more efficient and simpler if each layer does add up to 100?)

Say for example layer one's total is 150, two is 800, and three is 70, which is (10/150)*(5/800)*(10/70) = 0.00006 = 0,006%
Would that be correct?
 
That does make a lot more sense, thanks for the answer!

I assume your solution would still be viable if each layer's weight does not add up to 100 (However it's more efficient and simpler if each layer does add up to 100?)

Say for example layer one's total is 150, two is 800, and three is 70, which is (10/150)*(5/800)*(10/70) = 0.00006 = 0,006%
Would that be correct?
Yes, you would use the appropriate denominator for each individual probability.
 
Top