Learn R Programming

kml (version 2.1.2)

parKml: ~ Function: parKml ~

Description

parKml and parALGO are constructor for the object ParKml.

Usage

parKml(saveFreq,maxIt,imputationMethod,distanceName,power,distance,centerMethod,startingCond,nbCriterion,scale)

parALGO(saveFreq=100,maxIt=200,imputationMethod="copyMean",distanceName="euclidean",power=2,distance=function(){},centerMethod=meanNA,startingCond="nearlyAll",nbCriterion=100,scale=TRUE)

Arguments

saveFreq
[numeric]: Long computations can take several days. So it is possible to save the object ClusterLongData on which works kml once in a while.
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. imputationMethod define the method use to impute the missing value. See imputati
distanceName
[character]: name of the distance used by k-means. If the distanceName is one of "manhattan", "euclidean", "minkowski", "maximum", "canberra" or "binary", a compiled optimized version specificaly desig
power
[numeric]: If distanceName="minkowski", this define the power that will be used.
distance
[numeric <- function(trajA,trajB)]: function that computes the distance between two trajectories. If no function is specified, the Euclidian distance with Gower adjustment (to deal with missing value) is used.
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
startingCond
[character]: specifies the starting condition. Should be one of "randomAll", "randomK", "maxDist", "kmeans++", "kmeans+", "kmeans-" or "kmeans--" (see initialize
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 function scale with default values) before the execution of k-means on joint trajectories. Then the data

Value

  • An object ParKml.

Details

parKml is the constructor of object ParKml.

Examples

Run this code
### Generation of some data
cld1 <- generateArtificialLongData()

### Setting two different set of option :
(option1 <- parALGO())
(option2 <- parALGO(distanceName="maximum",centerMethod=function(x)median(x,na.rm=TRUE)))

### Running kml We suspect 3, 4 or 5 clusters, we want 3 redrawing.
kml(cld1,3:5,3,toPlot="both",parAlgo=option1)
kml(cld1,3:5,3,toPlot="both",parAlgo=option2)

Run the code above in your browser using DataLab