logEvidence | R Documentation |
A StudentRecord
differs from the baseline student
record according to how many EvidenceSet
objects
have been incorporated into the estimate. These functions tie and
student record and evidence set together.
logEvidence(eng, rec, evidMess)
seqno(x)
seqno(x) <- value
evidence(x)
evidence(x) <- value
eng |
A |
rec |
A |
evidMess |
A |
x |
An |
value |
For |
There are several fields in the StudentRecord
class which need to be updeated in the face of new evidence.
These needs to be set to the values in the new evidence message.
This needs to be incremented.
The new evidence needs to be prepended to this list.
The prev_id needs to point to the old field and the "_id" is set to NA (it will be updated on save).
In the case of the BNEngineMongo
, the IDs in
question are the database ids for these objects so that they can be
easily found. The function m_id
For the
BNEngineNDB
case presumably some external system
is issuing IDs to evidence sets and student records.
The evidence
field of a StudentRecord
is a
list of IDs (m_id
) for the accumulated evidence.
The seqno
field is an optional ordering used to track the order
in which evidence sets were incorporated into the student model. The
value of seqno
gives the number of evidence sets incorporated
into the recrod.
The logEvidence
function sets the sequence number of the
evidence message to one more than the last sequence number for the
student record. If no m_id
exists for the record
(no database mode), then one is generated by concatenating the
uid
and the seqno
.
The updateRecord
returns a new
StudentRecord
object, which points back to the
old one.
The logEvidence
function returns the modified
EvidenceSet
.
The function seqno
returns an integer (or NA
if has not
been set).
The function evidence
returns a character vector giving the IDs
(m_id
) of the encorpated evidence sets.
This is largely untested code for future fast retraction of evidence.
The prev_id
field of the StudentRecord
should leave a trace of previous student records in the database,
including old serialized models. This should allow the scoring engine
to quickly jump back in time.
The evidence
field provides a list of the
m_id
s of all the incorporated evidence sets.
This should enable one or more evidence sets to be replaced and the
student model to be recalculated.
Russell Almond
BNEngine
,
EvidenceSet
, EvidenceSet
StudentRecord
, handleEvidence
P4Message
sess <- RNetica::NeticaSession()
RNetica::startSession(sess)
Nethouse <- PNetica::BNWarehouse(sess=sess)
recset <- StudentRecordSet(warehouse=Nethouse,db=MongoDB(noMongo=TRUE))
sr0 <-
StudentRecord("S1","*baseline*",as.POSIXct("2020-03-30 09:00:00"))
seqno(sr0) <- 0
sr0 <- saveSR(recset,sr0) # Sets the m_id
e1 <- EvidenceSet(uid="S1",app="Test",context="PPcompEM",
obs=list("CompensatoryObs"="Right"))
e2 <- EvidenceSet(uid="S1",app="Test",context="PPdurAttEM",
obs=list("Attempts"=2,"Duration"=38.3))
stopifnot(is.na(seqno(e1)), seqno(sr0)==0L)
stopifnot(length(evidence(sr0))==0L)
e1 <- logEvidence(NULL,sr0,e1)
stopifnot(seqno(e1)==1L,!is.na(m_id(e1)))
sr1 <- updateRecord(sr0,e1)
stopifnot(is.na(m_id(sr1)),sr1@prev_id==m_id(sr0))
sr1 <- saveSR(recset,sr1) # Sets the m_id
stopifnot(length(evidence(sr1))==1L,any(m_id(e1)==evidence(sr1)))
stopifnot(context(sr1)==context(e1),timestamp(sr1)==timestamp(e1))
e2 <- logEvidence(NULL,sr1,e2)
stopifnot(seqno(e2)==2L,!is.na(m_id(e2)))
sr2 <- updateRecord(sr1,e2)
stopifnot(is.na(m_id(sr2)),sr2@prev_id==m_id(sr1))
sr2 <- saveSR(recset,sr2) # Sets the m_id
stopifnot(length(evidence(sr2))==2L,any(m_id(e2)==evidence(sr2)))
stopifnot(context(sr2)==context(e2),timestamp(sr2)==timestamp(e2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.