calcPnetLLike.NeticaBN | R Documentation |
The method calcPnetLLike.NeticaBN
calculates the log likelihood for a
set of data contained in cases
using the current conditional
probability tables in a Pnet.NeticaBN
. Here
cases
should be the filename of a Netica case file (see
write.CaseFile
).
## S4 method for signature 'NeticaBN'
calcPnetLLike(net, cases)
net |
A |
cases |
A character scalar giving the file name of a Netica case file
(see |
This function provides the convergence test for the
GEMfit
algorithm. The Pnet.NeticaBN
represents a model (with parameters set to the value used in the
current iteration of the EM algorithm) and cases
a set of data.
This function gives the log likelihood of the data.
This method expects the cases
argument to be a pathname
pointing to a Netica cases file containing the training or test data (see
write.CaseFile
). Also, it expects that there
is a nodeset (see NetworkNodesInSet
)
attached to the network called “onodes” which
references the observable variables in the case file.
As Netica does not have an API function to directly calculate the
log-likelihood of a set of cases, this method loops through the cases
in the case set and calls
FindingsProbability(net)
for each one. Note
that if there are frequencies in the case file, each case is weighted
by its frequency.
A numeric scalar giving the log likelihood of the data in the case file.
Russell Almond
Almond, R. G. (2015) An IRT-based Parameterization for Conditional Probability Tables. Paper presented at the 2015 Bayesian Application Workshop at the Uncertainty in Artificial Intelligence Conference.
Pnet
, Pnet.NeticaBN
,
GEMfit
, calcExpTables
,
BuildAllTables
, maxAllTableParams
NetworkNodesInSet
,
FindingsProbability
,
write.CaseFile
sess <- NeticaSession()
startSession(sess)
irt10.base <- ReadNetworks(system.file("testnets","IRT10.2PL.base.dne",
package="PNetica"), session=sess)
irt10.base <- as.Pnet(irt10.base) ## Flag as Pnet, fields already set.
irt10.theta <- NetworkFindNode(irt10.base,"theta")
irt10.items <- PnetPnodes(irt10.base)
## Flag items as Pnodes
for (i in 1:length(irt10.items)) {
irt10.items[[i]] <- as.Pnode(irt10.items[[i]])
}
CompileNetwork(irt10.base) ## Netica requirement
casepath <- system.file("testdat","IRT10.2PL.200.items.cas",
package="PNetica")
## Record which nodes in the casefile we should pay attention to
NetworkNodesInSet(irt10.base,"onodes") <-
NetworkNodesInSet(irt10.base,"observables")
llike <- calcPnetLLike(irt10.base,casepath)
DeleteNetwork(irt10.base)
stopSession(sess)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.