Speeding up the implementation of Stochastic Gradient Ascent in Python

Chris Angelico rosuav at gmail.com
Wed Jan 17 14:45:48 EST 2018


On Thu, Jan 18, 2018 at 6:28 AM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> You'll have to replace random.choice() with
> random.choice(list(...)), since you can't random.choice from a set.
>

Side point: why can't you? You can random.sample from a set, but
random.choice requires a sequence. It seems perfectly sane to ask for
a random element from a set.

ChrisA



More information about the Python-list mailing list