Classification and Combination Problem

1 vue (au cours des 30 derniers jours)
Priya
Priya le 9 Sep 2013
I have Dataset of 800 numbers. Minimum value is 0 and maximum value is 140.
Now I want to make 4 classes such that each class should have at least 160 data. If the above criteria is not satisfied for any one of the class, then discard that classification type and move forward to another classification type.
Classification type can be like 0 to 5, 5 - 20, 20 - 50, 50 - 140
Thanks

Réponses (2)

Shashank Prasanna
Shashank Prasanna le 9 Sep 2013
Start with KMEANS to perform the clustering. You can specify the number of classes or clusters but you can't enforce 'at least 160 data'.
  2 commentaires
Priya
Priya le 9 Sep 2013
Modifié(e) : Priya le 9 Sep 2013
How will I get the ranges / classes using this ??
Can I know what exactly is k means clustering ?
Shashank Prasanna
Shashank Prasanna le 9 Sep 2013
Its explained here:
Its a popular algorithm so feel free to look it up wiki or other locations.
Also go through the examples in the first link I provided. You can find the examples if you scroll all the way to the bottom. It is explained how to determine which class/cluster each entry belongs to.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 9 Sep 2013
This is a meaningless question unless you can give criteria. For example, what if I tell you that I took the histogram and divided that into 4 equal parts? What's wrong with that? Can you tell me if that is right? Or wrong? Not really as far as I can tell. But there are lots of ways you could split up the histogram into 4 parts and have at least 160 numbers in each. Without any other criteria, they are all potential solutions. If that's fine with you, then fine, otherwise say why it's not fine. You could also sort and extract, for example
%Create sample data
data = 140 * rand(1,800);
% Ssort it by value
sortedData = sort(data);
% Give one potential set of classes.
class1a = sortedData(1:160);
class2a = sortedData(161:320);
class3a = sortedData(321:480);
class4a = sortedData(481:end);
% Another set of classes that works.
class1b = sortedData(1:190);
class2b = sortedData(191:390);
class3b = sortedData(391:590);
class4b = sortedData(590:end);
So you can see by studying the above example that there are many possible solutions.

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by