buildHistMat: Builds history matrixes showing changes in Bayes nets over...

buildHistMatR Documentation

Builds history matrixes showing changes in Bayes nets over time.

Description

After each scoring context is processed, the EA process outputs a set of statistics to the AS process. This file scans through the logs of those messages to build a data frame showing the history of the recorded statistics over time. The function buildHistMat builds a matrix for a single user, and the function buildAppHist loops over all users in the database.

Usage

buildHistMat(col, app, uid)
buildAppHist(col, app)

Arguments

col

The mongo database collection which contains the logged statistics.

app

A character value identifying the application to build the history for. The long guid for the application is required here.

uid

A character value ident;yfing the user for whom to build the history.

Details

The statistics must be logged in a database collection for this to work. Note that the configStats function will determine which values are logged.

Value

A data.frame object with the following fields:

app

The guid of the application.

uid

The identifier for the user.

context

An identifier for the scoring context (e.g., game level).

timestamp

The timestamp for the last event from the scoring context.

...

Other fields correspoonding to the statsitics.

Author(s)

Russell Almond

See Also

woeBal, EAPBal ListenerSet

Examples

## Not run: 
## excerpt from doRunrun
if (!is.null(EA.config$histListener)) {
  hl <- eng$listenerSet$listeners[[EA.config$histListener]]
  if (is.null(hl)) {
    flog.warn("History listener %s not found, skipping building history file.",
               EA.config$histListener)
  } else {
    hist <- buildAppHist(hl$messdb(),appid)
    if (isTRUE(nrow(hist) > 0L)) {
      hist$app <- basename(hist$app)
      fname <- gsub("<app>",sappid,EA.config$histfile)

      write.csv(hist,file.path(outdir,fname))
      EAeng.params$listenerSet$registerOutput(fname,file.path(outdir,fname),
                                              appid,"EA")
    } else {
      flog.warn("No records in history file.")
    }
  }
}

## End(Not run)

ralmond/Proc4 documentation built on June 13, 2025, 7:13 a.m.