How to do it?

3 views (last 30 days)
Negar
Negar on 30 Nov 2014
Commented: Image Analyst on 30 Nov 2014
Hello all,
Is there any tutorial to learn implementing a flow chart in MATLAB? By flow chart, I mean something like this:
Let´s assume I have a data set, say 24 data points , each of which 2 dimensions. Id like to cluster them in an un pre-defined number of classes. Here is the instruction:
1.FIRST: Find the center(mean) point of the whole dataset. Split this point into 2 center points. Assign each datapoint to the nearest center. 2.NOW: for each center point, repeat point 1 until none of the data points changes its membership. I think it is working in a way similar to kmeans algorithm, but the number of the classes is not defined in advance.
thank you!
  1 Comment
Negar
Negar on 30 Nov 2014
Actually, Im stuck in the very basic part of the algorithm, I don't know how to relate each step to its previous. I have made a try, but it seems my code is not splitting the center point, it just changes its position. Here is my code:
c = [3;2.25]; % the center point of the whole dataset
k = 1 ;
eps = 1e-3;
while k<3
%split the centroid in 2
c(:,k+1) = c(:,k) + eps; % the first one
d(:,k+1) = c(:,k) - eps; % this is not working as expected!! So how to fix it?
k = k+1;
end

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 30 Nov 2014
Try these links on machine learning:
Look at the Statistics and Machine Learning section here:
especially the section on unsupervised learning.
  2 Comments
Negar
Negar on 30 Nov 2014
Thank you for responding, could you please have a look at my code? I can't manage how to store the center points.
Image Analyst
Image Analyst on 30 Nov 2014
I don't know what the code does exactly but it runs without any errors at all:
c = [3;2.25]; % the center point of the whole dataset
k = 1 ;
eps = 1e-3;
while k<3
%split the centroid in 2
c(:,k+1) = c(:,k) + eps; % the first one
d(:,k+1) = c(:,k) - eps; % this works - nothing to fix.
k = k+1;
end
c
d
But you should not use eps as the name of a variable since it's the name of a built in function.

Sign in to comment.

Categories

Find more on Statistics and Machine Learning Toolbox 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!