forked from akowalew/k-medoids-clustering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.R
43 lines (36 loc) · 913 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
43
# main.R
# Entry point of solution
# Runs scripts from analysis.R
#
# Author: akowalew
rm(list=ls())
graphics.off()
set.seed(1234)
source("analysis.R")
source("data-loading.R")
load("cec2013_5_2_50_-100_100")
# # normal check
# data <- GA@population
# nclusters <- 5
# metric <- "euclidean"
# r <- doClustering(GA@population, nclusters, metric)
# check all cases
fnumbers <- c(5, 6, 14)
dimensions <- c(10, 30, 50)
nnclusters <- c(3, 5)
metrics <- c("euclidean", "manhattan")
results <- lapply(fnumbers, function(fnumber) {
lapply(dimensions, function(dimension) {
population <- getPopulation(dimension, fnumber)
if(is.null(population))
return(NULL)
lapply(nnclusters, function(nclusters) {
lapply(metrics, function(metric) {
result <- doClustering(population, nclusters, metric)
result$data <- population
return(result)
})
})
})
})
save(results, file='k-medoids-results')