-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.R
42 lines (40 loc) · 1008 Bytes
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#setwd("D:\\Umang\\College\\MScAI\\SEM-I\\Project")
source("po.R")
source("functions.R")
source("algorithm.R")
main <- function(){
originalData = getdata()
MinD = minD(nrow(originalData))
print(MinD)
initialCentroid = NULL
check = TRUE
iterations = 1
while(check){
print(iterations)
check = FALSE
Summary = Quartile(originalData)
#print(Summary[1:3,])
cnt = 1
bin = list()
while(cnt < 4){
#print(originalData)
bin[[cnt]] = radius(Summary[cnt:(cnt + 2), ], originalData)
cnt = cnt + 1
}
cnt = 1
#print(MinD)
print(bin)
while(cnt<length(bin)){
if(densityOfBin(bin[[cnt]]) >= MinD){
originalData = remove(originalData,bin[[cnt]])
initialCentroid = rbind(initialCentroid,Summary[cnt+1,])
check = TRUE
}
cnt = cnt + 1
}
iterations = iterations + 1
}
print("Initial Centroids : ")
print(initialCentroid)
return(initialCentroid)
}