testNetwork {RNetica} | R Documentation |
This function takes a set of cases represented with a
CaseStream
and a network, and trys to classify the
values of the targetNodes
using the data in the cases. It
returns an object of class NetworkTester
which
contains statistics about the recovery of the target nodes from the
data.
testNetwork(targetNodes, dataStreams, ignoreNodes = list())
targetNodes |
A list of active |
dataStreams |
A list of active (open)
|
ignoreNodes |
A (possibly empty) list of active
|
The tester behaves a follows: It opens a
NetworkTester
object to hold the results. It
then runs through the case streams. For each case, it instantiates
each node in the network to the findings as found in the case stream,
except for those nodes in targetNodes
or ignoreNodes
.
It then looks at the NodeBeliefs
associated with the
targetNodes
and compares these with the actual value of the
target nodes as found in the case stream. It accumulates statistics
related to the accuracy.
After all case streams are processed, the
NetworkTester
object is returned and its
statistics can be queried. See testerConfusion
for a
list of available results.
An object of class NetworkTester
.
Netica's internal net tester object can add additional case sets at a
later time. However, RNetica, closes this object at the completion of
the call to testNetwork
, so a new test needs to be performed to
add more data to the test.
Russell Almond
Almond, R.G., Mislevy, R.J. Steinberg, L.S., Yan, D. and Willamson, D. M. (2015). Bayesian Networks in Educational Assessment. Springer. Chapter 7.
http://norsys.com/onLineAPIManual/index.html: NewNetTester_bn(), DeleteNetTester_bn(), TestWithCaseset_bn(), GetTestConfusion_bn(), GetTestErrorRate_bn(), GetTestLogLoss_bn(), GetTestQuadraticLoss_bn()
The output of testNetwork
is NetworkTester
.
Accessors for NetworkTester
testerConfusion
, testerErrorRate
,
testerIgnore
, testerKappa
,
testerLambda
, testerLogLoss
,
testerNet
, testerQuadraticLoss
,
testerTarget
sess <- NeticaSession() startSession(sess) irt5 <- ReadNetworks(file.path(library(help="RNetica")$path, "sampleNets","IRT5.dne"), session=sess) irt5.theta <- NetworkFindNode(irt5,"Theta") irt5.x <- NetworkFindNode(irt5,paste("Item",1:5,sep="_")) CompileNetwork(irt5) ## This generates a fixed series of random cases and saves them to a ## file. N <- 100L rnodes <- c(list(irt5.theta),irt5.x) casefile <- tempfile("irt5testcase",fileext=".cas") filestream <- CaseFileStream(casefile, session=sess) rng <- NewNeticaRNG(123456779, session=sess) WithOpenCaseStream(filestream, WithRNG(rng, for (n in 1L:N) { GenerateRandomCase(rnodes,rng=rng) WriteFindings(rnodes,filestream,n) lapply(rnodes,RetractNodeFinding) # Only retract findings for # generated nodes })) irt5.test <- testNetwork(list(irt5.theta),OpenCaseStream(filestream)) summary(irt5.test) DeleteNetwork(irt5) stopSession(sess)