1 getLabel = function(fileName)
3 return (as.integer(as.matrix(read.table(fileName))))
6 getData = function(fileName)
8 return (as.matrix(read.table(fileName,sep=',')))
11 plotCurves = function(data, cols=rep(1,nrow(data)), ylim=range(data), ...)
13 for (i in 1:nrow(data))
18 plot(data[i,],type="l",col=cols[i],ylim=ylim, ...)
22 getDistor = function(data, ctrs)
25 for (i in 1:nrow(data))
26 distor = distor + min(sqrt(colSums((t(ctrs) - data[i,])^2)))
30 getPartition = function(data, ctrs)
33 for (i in 1:nrow(data))
34 partition = c(partition, which.min(sqrt(colSums((t(ctrs) - data[i,])^2))))
38 #~ system("R CMD SHLIB hungarian.c")
39 #~ dyn.load("hungarian.so")
40 comparePartitions = function(partition1, partition2)
43 n = length(partition1)
44 maxInd = max(partition1)
45 return ( .C("computeCoefSimil", P1=as.integer(partition1), P2=as.integer(partition2),
46 maxInd=as.integer(maxInd), n=as.integer(n), coefSimil=as.double(result))$coefSimil )