-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Original ticket http://projects.scipy.org/numpy/ticket/445 on 2007-02-05 by trac user cvwright, assigned to @rkern.
The histogram() function, when called with normed=True, returns incorrect results for the bins' frequencies. The frequencies should sum to 1.0 in order to be a real probability distribution, but usually with the current code they do not.
Looking at the current version of the code in trac, I believe the problem is on lines 105 and 106 of function_base.py. On line 105, we calculate the width of a bin, and on line 106, we divide the counts for each bin by the size of the input times the bin width. I think the problem could be fixed by simply removing the bin width calculation and instead dividing the bin counts by only the number of samples in the input.