- To know more about dataset: https://www.mathworks.com/matlabcentral/answers/442242-how-to-load-fisheriris-data-set-by-reducing-the-number-of-sample-for-each-species
- "train” function: https://www.mathworks.com/help/deeplearning/ref/network.train.html
- “selforgmap” function: https://www.mathworks.com/help/deeplearning/ref/selforgmap.html
How to plot SOM results in Cluster form or How to check how many cluster are formed using self-organizing map
12 次查看(过去 30 天)
显示 更早的评论
Hello i hope you are doing well. I am using Neural Net Clustering app to cluster Fisher iris Dataset.
I want to see the clustering Result or How to check how may cluster are formed using self-organizing map
load fisheriris.mat
P=meas;
net=selforgmap([10 10]);
net=configure(net,P);
net=train(net,P);
view(net);
y=net(P);
classes=vec2ind(y);
0 个评论
回答(1 个)
Purvaja
2025-4-2
I understand that you want to see how clusters are formed in using SOM networks and print the data points cluster wise. Referring to the code provided by you, you are trying to fit a Self-Organising Map on a “meas” data in “firsheriris.mat” dataset. It consists of 150 samples with 4 features in [150x4] format. The “train” function in MATLAB needs dataset in dimension of “input size” by “batch size”, assuming input size determines no of features and batch size determines number of inputs. So, for training SOM network, transpose of “meas” dataset is required.
For clustering inputs, inputs will be grouped according to the neurons that generated maximum activation value for that input. Hence, input values having highest activation value for same neuron will fall in same cluster.
Refer to the below code snippet to achieve the result:
load fisheriris.mat
P = meas'; % Transpose of dataset
dimension1 = 5;
dimension2 = 5;
net = selforgmap([dimension1 dimension2]); % using [5 5] dimension for this example
[net,tr] = train(net,P);
outputs = net(P);
% Determine which inputs belong to which cluster
[~, cluster_indices] = max(outputs, [], 1);
clustered_inputs = cell(dimension1 * dimension2, 1);
for i = 1:length(cluster_indices)
cluster_number = cluster_indices(i);
clustered_inputs{cluster_number} = [clustered_inputs{cluster_number}, P(:,i)];
end
for i = 1:length(clustered_inputs)
disp(['Cluster ' num2str(i) ':']);
disp(clustered_inputs{i});
end
Refer to this MATLAB question where the question posted have a similar answer. Answer consists of the results of how clusters are formed:
For any more clarifications, refer to the following MATLAB answer and the documentation:
To access release specific documentation by typing these commands in your MATLAB command window respectively:
web(fullfile(docroot,'deeplearning/ref/network.train.html'))
web(fullfile(docroot,'deeplearning/ref/selforgmap.html'))
Hope this solves your doubt!
0 个评论
另请参阅
类别
在 Help Center 和 File 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!