How to do it?

1 次查看(过去 30 天)
Negar
Negar 2014-11-30
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 个评论
Negar
Negar 2014-11-30
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

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2014-11-30
Try these links on machine learning:
Look at the Statistics and Machine Learning section here:
especially the section on unsupervised learning.
  2 个评论
Negar
Negar 2014-11-30
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 2014-11-30
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by