No, that's Python's random module, not numpy. Numpy allows weights


On 25 January 2014 22:56, Joel Nothman <jnothman@student.usyd.edu.au> wrote:

> And Jenkins is cool with that??
>
>
> On 25 January 2014 22:53, Arnaud Joly <notifications@github.com> wrote:
>
>>  In sklearn/datasets/samples_generator.py:
>>
>> > @@ -309,7 +317,7 @@ def sample_example():
>> >          y = []
>> >          while len(y) != n:
>> >              # pick a class with probability P(c)
>> > -            c = generator.multinomial(1, p_c).argmax()
>> > +            c = np.searchsorted(cumulative_p_c, generator.rand())
>>
>>  np.random.choice(n_classes, n, replace=False, p=p_c) is apparently the
>> answer; New in version 1.7.0.
>>
>> It seems that some testing modules already use choice
>>
>> sklearn/datasets/tests/test_lfw.py:            name = random_state.choice(more_than_two)
>> sklearn/datasets/tests/test_lfw.py:            first_index = random_state.choice(np.arange(counts[first_name]))
>> sklearn/datasets/tests/test_lfw.py:            second_index = random_state.choice(np.arange(counts[second_name]))
>> sklearn/neighbors/tests/test_kde.py:def test_kde_algorithm_metric_choice():
>>
>> —
>> Reply to this email directly or view it on GitHub<https://github.com/scikit-learn/scikit-learn/pull/2773/files#r9171239>
>> .
>>
>
>