I'd use unique and bincount. that should be efficient.



erg <notifications@github.com> schrieb:

>> @@ -1245,3 +1249,332 @@ def balance_weights(y):
>>      weights *= bins.min()
>>  
>>      return weights
>> +
>> +
>> +def _histogram(array):
>
>I didn't know about ``np.bincount``, and it's almost exactly what I
>want, except that the classes are arbitrary and not just integers. I
>could ``LabelEncoder`` them first, but that should be slower than a
>proper ``_histogram`` implementation?
>
>---
>Reply to this email directly or view it on GitHub:
>https://github.com/scikit-learn/scikit-learn/pull/1454/files#r3216420

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.