bfortuner / pytorch_tiramisu

FC-DenseNet in PyTorch for Semantic Segmentation
MIT License
306 stars 65 forks source link

strange term `random.choices` #1

Closed amiltonwong closed 6 years ago

amiltonwong commented 7 years ago

Hi, @bfortuner ,

I found a strange term random.choices in this line. There is no random.choices (link) . Is it a typo or have special meaning?

manuelhaussmann commented 7 years ago

There is no numpy.random.choices, but there is arandom.choices. See link

Khanimar commented 6 years ago

It's written in Python 3. Change that line to return ''.join(random.choice(string.ascii_uppercase + string.digits)) and run it via Python 2.

raghavab1992 commented 6 years ago

random.choices is available in python 3.6. i think you can use random.sample instead. ''.join(random.sample(string.ascii_uppercase + string.digits, k=n))

But sample gives elements without replacement whereas choices gives elements with replacement. Not sure if this affects the prediction accuracy of the model though!