[proxy] bugs.python.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

Message 357257 - Python tracker

Message357257

Author IRomanowska
Recipients IRomanowska, mark.dickinson, rhettinger, tim.peters
Date 2019-11-22.09:15:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574414104.81.0.295238897869.issue38881@roundup.psfhosted.org>
In-reply-to
Content
Dear Raymond, 

I understand that passing all zero weights may look nonsensical but random.choices is an implementation of the roulette wheel which is widely used across different scientific disciplines and the situation of passing all zeros is completely plausible. 

In genetics:
A genome may consist of a set of genes none of which increases fitness thus their relative probability of being copied over other genes is all zero. 

In political sciences or cultural evolution:
A voter may hate all parties (ie. their individual preference for any one party is zero). An agent may happen to have no preference for either of the options. 

In engineering: 
All solutions may carry zero increase in performance. 

You are absolutely right that negative weights make no sense (how can you choose option A with a -10% chance. But a 0% chance is entirely possible. 

I consulted with colleagues working in other languages and it looks that the default for roulette wheel with zero weights is choosing at random. 
This should probably be consulted with a mathematician who knows the definition of the algorithm.
History
Date User Action Args
2019-11-22 09:15:04IRomanowskasetrecipients: + IRomanowska, tim.peters, rhettinger, mark.dickinson
2019-11-22 09:15:04IRomanowskasetmessageid: <1574414104.81.0.295238897869.issue38881@roundup.psfhosted.org>
2019-11-22 09:15:04IRomanowskalinkissue38881 messages
2019-11-22 09:15:04IRomanowskacreate