Escolar Documentos
Profissional Documentos
Cultura Documentos
Code
clear all;
close all;
clc
[D,N,K] = Input_Data()
%Taking Input data from users
%D is dimension 2-D or More-D
%N is total number of Data points
% while K is total Number of cluster
%And defining of K doesn't mean that the K-mean Clustering is supervised clustering
can be supervised only in special cases
%Randomly Generating Data
xn = floor(abs(rand(D,N))*255);%floor is use to remove or ignore float data
u = floor(abs(rand(D,K))*255); %u is means of the data
c = zeros(1,N) %c is the centroid location initially we place it randomly
scatter(u(1,points),u(2,points),'x',color)
hold on
end
hold off
end
Function
function [D,N,K] = Input_Data()
%Taking Inputs
D = input('Enter Dimension of Data: ')
N = input('Enter Number of Points: ')
K = input('Enter Number of Clusters: ')
end
Plots
User Input and Random Data with random centroids