mcEvaluateAllClusters: Evaluates all next page clicks in a clickstream training data...

View source: R/Evaluation.r

mcEvaluateAllClustersR Documentation

Evaluates all next page clicks in a clickstream training data set against a test data

Description

Evaluates all next page clicks in a clickstream training data set against a test data on the basis of a set of pre-computed Markov chains and corresponding clusters. Handles higher order by cycling through every possible pattern permutation. Produces and produces a report of observed and expected values in a matrix

Usage

mcEvaluateAllClusters(
  markovchains,
  clusters,
  testCLS,
  trainingCLS,
  includeChiSquare = TRUE,
  returnChiSquareOnly = FALSE
)

Arguments

markovchains

A list of MarkovChain-objects.

clusters

The list of clusters.

testCLS

Clickstream object with test data.

trainingCLS

Clickstream object with training data (this should be the data used to build the markov chain object).

includeChiSquare

Should the result include the chi-square value?

returnChiSquareOnly

Should the result only consist of the chi-square value?

Author(s)

Theo van Kraay theo.vankraay@hotmail.com

See Also

mcEvaluateAll

Examples

training <- c("User1,h,c,c,p,c,h,c,h,o,p,p,c,p,p,o",
              "User2,i,c,i,c,c,c,o,o,o,i,d",
              "User3,h,i,c,i,c,o,i,p,c,c,p,c,c,i,d",
              "User4,c,c,p,c,d,o,i,h,o,o")

test <- c("User1,h,c,c,p,p,h,o,i,c,p,p,c,p,p,o",
          "User2,i,c,i,c,c,c,d",
          "User4,c,c,c,c,d")

csf <- tempfile()
writeLines(training, csf)
trainingCLS <- readClickstreams(csf, header = TRUE)
unlink(csf)

csf <- tempfile()
writeLines(test, csf)
testCLS <- readClickstreams(csf, header = TRUE)
unlink(csf)

clusters <- clusterClickstreams(trainingCLS, centers = 2, order = 1)
markovchains <- fitMarkovChains(clusters, order = 2)
mcEvaluateAllClusters(markovchains, clusters, testCLS, trainingCLS)

clickstream documentation built on Sept. 27, 2023, 5:06 p.m.