Learn R Programming

clickstream (version 1.1.0)

predict.ClickstreamClusters: Predicts the cluster for a given Pattern object

Description

Predicts the cluster for a given Pattern object. Potential clusters need to be identified with the method clusterClickstreams before predicting the cluster.

Usage

## S3 method for class 'ClickstreamClusters':
predict(object, pattern, ...)

Arguments

object
A ClickstreamClusters object containing the potential clusters. A ClickstreamClusters object represents the result of a cluster analysis on a list of clickstreams (see clusterClic
pattern
The first clicks of a user as Pattern object.
...
Ignored parameters.

Value

  • Returns the index of the clusters to which the given Pattern object most probably belongs to.

See Also

clusterClickstreams, print.ClickstreamClusters

Examples

Run this code
clickstreams<-c("User1,h,c,c,p,c,h,c,p,p,c,p,p,o",
               "User2,i,c,i,c,c,c,d",
               "User3,h,i,c,i,c,p,c,c,p,c,c,i,d",
               "User4,c,c,p,c,d",
               "User5,h,c,c,p,p,c,p,p,p,i,p,o",
               "User6,i,h,c,c,p,p,c,p,c,d")
csf<-tempfile()
writeLines(clickstreams, csf)
cls<-readClickstreams(csf, header=TRUE)
clusters<-clusterClickstreams(cls, order=0, centers=2)
pattern<-new("Pattern", sequence=c("h", "c"))
predict(clusters, pattern)

Run the code above in your browser using DataLab