BNEngine-class | R Documentation |
"BNEngine"
A generic engine for handling evidence messages
(EvidenceSet
objects).
This is the basic class for running the evidence accumulation
process. This is actually an abstract class, there are two
subclasses: BNEngineMongo
, which uses the Mongo
database to store student records and as a message queue, and
BNEngineNDB
, which operates without a database.
Note that the BNEngine
constructor generates an error.
The following functions form the core of the Engine Protocol:
loadManifest
This loads the network manifest
for the PnetWarehouse
.
setupDefaultSR
Sets up the default Student Record (used for creating new student records)
configStats
Configures the statistics that are reported in the main loop.
baselineHist
Sets up the baselines for histories.
mainLoop
This runs through a queue of messages, handling the evidence.
handleEvidence
Handles evidence from one scoring context and one user.
accumulateEvidence
Does the actual work of processing the evidence.
getRecordForUser
Fetches the student record for
a user, essentially a call to getSR
.
logEvidence
Logs the evidence as part of the student record.
updateSM
Updates the student model for the new evidence.
updateStats
Calculates new statistics for the revised student model.
updateHist
Updates the history for the revised student model.
announceStats
Updates other processes about the existance of updated statistics.
All reference classes extend and inherit methods from "envRefClass"
.
signature(x = "BNEngine")
: Returns the guid
identifying the application that this engine is handling.
signature(sender = "BNEngine")
:
Notifies other processes that student records have been updated.
signature(eng = "BNEngine")
: Returns
the next unprocessed EvidenceSet
in the queue.
signature(eng = "BNEngine", eve =
"EvidenceSet")
: marks the eve
argument as processed.
app
:Object of class character
giving an
globally unique identifier for the application
srs
:Object of class
StudentRecordSet
of NULL
giving the
student record set for the application.
profModel
:Object of class character
giving the
name of the proficiency model (for the default student record) in
the warehouse manifest.
listenerSet
:Object of class ListenerSet
giving
a set of listeners who will listen for new statistics.
statistics
:Object of class list
containing
Statistic
objects to be run on every update
cycle.
histNodes
:Object of class character
giving the
names of the nodes in the proficiency model whose history will be
recorded.
warehouseObj
:Object of class
PnetWarehouse
which stores the Bayes nets, both evidence models and student
models are stored here.
waittime
:Object of class numeric
giving the
time in seconds the main event loop should wait before checking
again for messages.
processN
:Object of class numeric
giving the
number of times that the main loop should run before stopping. If
Inf
, then the main loop will run without stopping.
activate()
:Sets the flag to indicate that the process is running.
deactivate()
:Clears the flag to indicate that the process is no longer running.
shouldHalt()
:This function checks the database to see whether or not the flag is set to cause the process to halt after processing the current record..
stopWhenFinished()
:This function checks the database to see whether or not the flag is set to cause the process to stop when the event queue is empty.
setHistNodes(nodenames)
: Sets the names of the
history nodes. Note this should be called before the call to
baselineHist
or the history nodes will not be set
properly in the default student record.
fetchNextEvidence()
:Fetches the next evidence set to be handled.
setError(mess, e)
:Adds an error flag to an evidence set that generated an error.
getHistNodes()
:Retrieves the history nodes.
saveStats(statmat)
:Updates the set of statitics associated with this engine.
studentRecords()
: Fetches the
StudentRecordSet
associated with the engine.
Note: This method should be called instead of the raw field as it
will initialize the field if it is not set up yet.
fetchStats()
:Fetches statistic objects from the database.
stats()
:Returns the set of
Statistic
objects associate with the engine.
fetchManifest()
:Fetches the network manifest from the database.
setManifest(manifest)
: Sets the manifest for the
PnetWarehouse
.
saveManifest(manifest)
:Saves the network manifest to the database.
show()
:Providse a printed representation of the database.
setProcessed(mess)
:Sets an evidence set message as processed.
warehouse()
: Returns the
PnetWarehouse
associated with this
engine. Again, this function should be called in preference to
directly accessing the field as it forces initialization when necessary.
evidenceSets()
:A reference to the collection of evidence sets.
Russell Almond
Almond, Mislevy, Steinberg, Yan and Williamson (2015). Bayesian Networks in Educational Assessment. Springer. Especially Chapter 13.
Subclasses:
BNEngineMongo
, BNEngineNDB
Constituent parts:
StudentRecordSet
, PnetWarehouse
Setup Functions:
loadManifest
,
setupDefaultSR
,
configStats
,
baselineHist
,
Main Loop Functions:
mainLoop
,
handleEvidence
,
getRecordForUser
,
logEvidence
,
accumulateEvidence
,
updateRecord
,
updateSM
,
updateStats
,
updateHist
,
announceStats
,
showClass("BNEngine")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.