Learn R Programming

catnet (version 1.08.2)

cnEvaluate-method: Network Evaluation from Data

Description

For a catNetwork and some data, the function returns a list of networks, 'compatible' with the given network, that best fit the data and compare them.

Usage

cnEvaluate(object, data, perturbations=NULL, maxParentSet=0, maxComplexity=0, echo=FALSE)

Arguments

object
a catNetwork
data
a matrix in row-nodes format or a data.frame in column-nodes format
perturbations
a binary matrix with the dimensions of data. A value of 1 marks the corresponding node in the data as perturbed. See cnSamples for more details.
maxParentSet
an integer, the maximal allowed parents per node for the search
maxComplexity
an integer, the maximal network complexity for the search
echo
a logical that sets on/off some functional progress and debug information

Value

  • A catNetworkEvaluate object.

Details

The data can be a matrix of character categories with rows specifying the node-variables and columns assumed to be independent samples, or a data.frame with columns specifying the nodes and rows being the samples.

The data can be a sample generated from the network object, or may not, but in both cases, it must have the same nodes as the given network. Therefore, the rows, if data is a matrix, or the columns, if data is a data.frame, should be named after the object's nodes. The function searches in the class of networks contingent with the topological order of the given network, object. The result is a catNetworkEvaluate object that contains the set of optimal networks within the specified complexity range, up to maxComplexity, and several distance measures between these networks and the object. See the description of cnCompare for more details about the used comparison criteria.

If maxParentSet is not specified, and so it is 0 by default, then the maximum number of parents of the object is used.

If maxComplexity is not specified, and so it is 0 by default, then the complexity of the object is used as a maximum value.

cnEvaluate function can be used for reducing a complex network to a less complex one. This can be achieved by generating a large sample from the original network, then evaluating it to obtain a list of networks with increasing complexity fitting this sample, and finally, selecting a smaller network from this list.

See Also

cnSamples,catNetworkEvaluate-class, cnSearchOrder

Examples

Run this code
cnet <- cnRandomCatnet(numnodes=12, maxParents=3, numCategories=2)
  psamples <- cnSamples(object=cnet, numsamples=20, output="matrix")
  perturbations <- matrix(rep(0, length(psamples)), nrow = nrow(psamples))
  nets <- cnEvaluate(object=cnet, data=psamples, perturbations, 
	maxParentSet =2, maxComplexity=36, echo=TRUE)
  nets
  cnPlot(nets)

Run the code above in your browser using DataLab