How to determine the number of bins and the edge length based on the density of each bin. (Bins most likely are not uniform.)
Afficher commentaires plus anciens
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 commentaire
tsan toso
le 18 Oct 2013
Réponses (1)
Image Analyst
le 18 Oct 2013
0 votes
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 commentaires
tsan toso
le 18 Oct 2013
Image Analyst
le 18 Oct 2013
Actually I think you're right. There are clustering methods that can figure out how many clusters you should have based on some hints/criteria you give it, but I don't remember those off the top of my head. You should search for "upsupervised cluster*" to learn about those methods. I think the stats toolbox should have something like that - you mgiht call them and ask them. And once they've identified the clusters in your data then, of course, you'll know the histogram bin edge locations for the clusters also because it's the same thing/concept.
Image Analyst
le 18 Oct 2013
Try this clustering app by Brett Shoelson: http://www.mathworks.com/matlabcentral/fileexchange/35014-clusterdata
tsan toso
le 19 Oct 2013
Catégories
En savoir plus sur k-Means and k-Medoids Clustering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!