| ParKml-class {kml} | R Documentation |
~ Class: "ParKml" ~
Description
ParKml is an object containing some parameter used by kml.
Slots
saveFreq[numeric]: Long computations can take several days. So it is possible to save the objectClusterLongDataon which workskmlonce in a while.saveFreqdefines the frequency of the saving process. TheClusterLongDatais saved everysaveFreqclustering calculations. The object is saved in the fileobjectName.Rdatain the curent folder. IfsaveFreqis set toInf, the object is never saved.maxIt:[numeric]: Set a limit to the number of iteration if convergence is not reached.imputationMethod:[character]: the calculation of quality criterion can not be done if some value are missing.imputationMethoddefine the method use to impute the missing value. Seeimputationfor detail.distanceName:[character]: name of thedistanceused by k-means. If thedistanceNameis one of "manhattan", "euclidean", "minkowski", "maximum", "canberra" or "binary", a compiled optimized version specificaly design for trajectories version is used. Otherwise, the function define in the slotdistanceis used.power:[numeric]: IfdistanceName="minkowski", this define the power that will be used.distance:[numeric <- function(trajA,trajB)]: function that computes the distance between two trajectories. This field is used only if 'distanceName' is not one of the classical function.centerMethod:[numeric <- function(vector(numeric))]: k-means algorithm computes the centers of each cluster. It is possible to personalize the definition of "center" by defining a function "centerMethod". This function should take a vector of numeric as argument and return a single numeric -the center of the vector-.startingCond:[character]: specifies the starting condition. Should be one of "randomAll", "randomK", "maxDist", "kmeans++", "kmeans+", "kmeans-" or "kmeans–" (seeinitializePartitionfor details). It also could take two specifics values: "all" stands for c("maxDist","kmeans-") then an alternance of "kmeans–" and "randomK" while "nearlyAll" stands for "kmeans-" then an alternance of "kmeans–" and "randomK".nbCriterion[numeric]: set the maximum number of quality criterion that are display on the graph (since displaying a high criterion number an slow down the overall process). The default value is 100.- scale
[logical]: if TRUE, then the data will be automaticaly scaled (using the functionscalewith default values) before the execution of k-means on joint trajectories. Then the data will be restore (using the functionrestoreRealData) just before the end of the functionkml3d. This option has no effect onkml.
Methods
object['xxx']Get the value of the field
xxx.
Examples
### Move to tempdir
wd <- getwd()
setwd(tempdir()); getwd()
### Building data
myCld <- gald()
### Standard kml
kml(myCld,,3,toPlot="both")
### Using median instead of mean
parWithMedian <- parALGO(centerMethod=function(x){median(x,na.rm=TRUE)})
kml(myCld,,3,toPlot="both",parAlgo=parWithMedian)
### Using distance max
parWithMax <- parALGO(distanceName="maximum")
kml(myCld,,3,toPlot="both",parAlgo=parWithMax)
### Go back to current dir
setwd(wd)