Classification and Combination Problem

3 views (last 30 days)
Priya
Priya on 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

Answers (2)

Shashank Prasanna
Shashank Prasanna on 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 Comments
Priya
Priya on 9 Sep 2013
Edited: Priya on 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 on 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.

Sign in to comment.


Image Analyst
Image Analyst on 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.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!