How to determine the number of bins and the edge length based on the density of each bin. (Bins most likely are not uniform.)

1 Ansicht (letzte 30 Tage)
Non-uniform bin density Hi,
I have been trying to figure out how to write a function to bin a sample of data together based on its density (Number of Occurrence/ Length of edge). But there are not alot of examples out there.
The output would give a vector of edges where both :
1) the number of bins are given by how many are required to group data that have different density by a threshold (maybe 40%?)
2) and the length of the edges are determined by if the adjacent data groups have similar density. (Similar density are grouped together, but if the neighboring bin is 40% more or less in density, it would require another bin).
So to illustrate my point, below is a simple example:
I have data values that ranges from 1 to 10 and I have 10 observations of it where x=[1,2,3,4,5,5,5,6, 6,7];
x would result in a range with edges that are [1,5,6,7,8], so there are four states just because the bins represent different density clusters.
Just to mention my actual data is continuous, any help is appreciated.
Regards,
Tresno
  1 Kommentar
tsan toso
tsan toso am 18 Okt. 2013
Just to continue from the above example. I thought of a preliminary algorithm for large data samples:
1. Sort data in ascending order.
2. Group data where at least a group has 10 elements
3. Calculate and compare density to group similar ones together.
I got stuck on the 3rd point. Where I am not sure how to effectively group them. My obstacle comes from if the density increases slowly, but gradually e.g. Density: 1,2,3,4,5,6,7,8,9,10
Where do I call it break and say that one group has a different density from another.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 18 Okt. 2013
Try using kmeans clustering in the stats toolbox. For an example, see http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html
  4 Kommentare
tsan toso
tsan toso am 19 Okt. 2013
Hey thanks for the feedback. Did look at the app, however, it seems to cluster groups of data based on how close they are to each other (not exactly based on the sparsity of the data)...would ask if Brett if he have any thoughts.
Thanks again.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by