1 ppam_exe = function(path=".", np=parallel::detectCores(), data=NULL,
2 nbSeriesPerChunk, nbClusters, randomize=1, p_dissims=2)
4 args = paste(nbSeriesPerChunk," ",nbClusters," ",randomize," ",p_dissims,sep="")
6 command_line = paste("mpirun -np ",np," ",path,"/ppam.exe cluster",sep="")
8 #if data provided (as data.frame or matrix...): binarize it, and add it as first argument
11 if (!is.character(data))
13 #assuming matrix or data.frame, WITH row names
14 #( identifiers; could be line number... e.g. data <- cbind(1:nrow(data),data) )
15 write.table(data, "/tmp/data_csv", sep=",", row.names=FALSE, col.names=FALSE)
16 system(paste(path,"/ppam.exe serialize /tmp/data_csv /tmp/data_bin 0 0",sep=""))
19 system(paste(path,"/ppam.exe serialize ",data," /tmp/data_bin 0 0",sep=""))
21 command_line = paste(command_line," /tmp/data_bin",sep="")
24 command_line = paste(command_line," ",args,sep="")
28 #NOTE: identifiers in first column
29 getMedoids = function(path=".", xmlResult = "ppamResult.xml",
30 finalSeries = "ppamFinalSeries.bin")
32 system(paste(path,"/ppam.exe deserialize ",finalSeries," ppamFinalSeries.csv -1",sep=""))
33 curves = read.table("ppamFinalSeries.csv", sep=",")
35 ranks = as.integer( xmlToList( xmlParse(xmlResult) )$ranks )
36 return ( curves[ranks,] ) # == medoids
39 getDistor = function(path=".", xmlResult = "ppamResult.xml",
40 finalSeries = "ppamFinalSeries.bin")
42 system(paste(path,"/ppam.exe classif ",finalSeries," ",xmlResult,sep=""))
45 serialize = function(path=".", csvSeries, binSeries, byCols=0, nbSeries=0)
47 system(paste(path,"/ppam.exe serialize ",csvSeries," ",binSeries," ",byCols," ",nbSeries,
51 deserialize = function(path=".", binSeries, csvSeries, ranks="-1", return=TRUE)
53 system(paste(path,"/ppam.exe deserialize ",binSeries," ",csvSeries," ",ranks,sep=""))
55 return ( read.table(csvSeries, sep=",") )