Please help me understand output from discretize
I am trying to understand what discretize is doing, I have data ranging from 0 to 1 and want to bin it in bins of size .01.
X=[.01:.01:1] ; % – example data uniformly going form .01 to 1 in steps of .01
binEdges=[0:0.01:1]; %- the bind edges
binLocs=discretize(X,binEdges,’IncludedEdge’,’right’); %
%I would expect each bin gets 1 value so that bon locs is [1 2 3 4 5 6 7 8 9 10 etc… up to 100]
but what I get is binLocs=
1 2 3 4 5 7 7 8 9 10 11 12 13 14 16 16 17 19 19 20 22 22 23 25 25 26 27 28 30 30 31 32 33 34 35 37 37 38 39 40 41 43 43 44 45 46 47 49 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
why is is repeating some (for example the values .06 and .07 go in bin 7 and nothing in bin 6 ?
I’d like the first bin to b 0<=x<=.01 bin 2 .01<x<=.02 bin 3 .02<x<=.03 etc..
can someone explain why I am getting 2 values in some bins ( i.e. bin 7 and bin 22)
Thanks,
-JeffI am trying to understand what discretize is doing, I have data ranging from 0 to 1 and want to bin it in bins of size .01.
X=[.01:.01:1] ; % – example data uniformly going form .01 to 1 in steps of .01
binEdges=[0:0.01:1]; %- the bind edges
binLocs=discretize(X,binEdges,’IncludedEdge’,’right’); %
%I would expect each bin gets 1 value so that bon locs is [1 2 3 4 5 6 7 8 9 10 etc… up to 100]
but what I get is binLocs=
1 2 3 4 5 7 7 8 9 10 11 12 13 14 16 16 17 19 19 20 22 22 23 25 25 26 27 28 30 30 31 32 33 34 35 37 37 38 39 40 41 43 43 44 45 46 47 49 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
why is is repeating some (for example the values .06 and .07 go in bin 7 and nothing in bin 6 ?
I’d like the first bin to b 0<=x<=.01 bin 2 .01<x<=.02 bin 3 .02<x<=.03 etc..
can someone explain why I am getting 2 values in some bins ( i.e. bin 7 and bin 22)
Thanks,
-Jeff I am trying to understand what discretize is doing, I have data ranging from 0 to 1 and want to bin it in bins of size .01.
X=[.01:.01:1] ; % – example data uniformly going form .01 to 1 in steps of .01
binEdges=[0:0.01:1]; %- the bind edges
binLocs=discretize(X,binEdges,’IncludedEdge’,’right’); %
%I would expect each bin gets 1 value so that bon locs is [1 2 3 4 5 6 7 8 9 10 etc… up to 100]
but what I get is binLocs=
1 2 3 4 5 7 7 8 9 10 11 12 13 14 16 16 17 19 19 20 22 22 23 25 25 26 27 28 30 30 31 32 33 34 35 37 37 38 39 40 41 43 43 44 45 46 47 49 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
why is is repeating some (for example the values .06 and .07 go in bin 7 and nothing in bin 6 ?
I’d like the first bin to b 0<=x<=.01 bin 2 .01<x<=.02 bin 3 .02<x<=.03 etc..
can someone explain why I am getting 2 values in some bins ( i.e. bin 7 and bin 22)
Thanks,
-Jeff discretize, binning MATLAB Answers — New Questions