cnCompare: Network Comparison

cnCompare-methodR Documentation

Network Comparison

Description

Compares two catNetwork objects by several criteria

Usage

cnCompare(object1, object2, extended = TRUE)

Arguments

object1

a catNetwork object

object2

a catNetwork object, matrix, list of catNetworks or catNetworkEvaluate object

extended

a logical parameter, specifying whether basic but quicker or extended comparison to be performed

Details

Comparison can be performed only between networks with the same sets of nodes. The function considers several topology-related comparison metrics.

First, directed edge comparison is performed and the true positives (TP), the false positive (FP) and the false negatives (FN) are reported assuming object1 to be the 'true' network.

Second, the difference between the binary parent matrices of the two objects is measured as the number of positions at which they differ. This is the so called Hamming distance and it is coded as hamm. Also, when extended parameter is set to TRUE, the difference between the exponents of the parent matrices is calculated, hammexp.

Third, the node order difference between the two networks is measured as follows. Let us call 'order pair' a pair of indices (i,j) such that there is a directed path from j-th node to i-th node in the network, which sometimes is denoted by j>i. The order comparison is done by counting the false positive and false negative order pairs.

The fourth criteria accounts for the so called 'Markov blanket'. The term 'Markov pair' is used to denote a pair of indices which corresponding nodes have a common child. In case of extended comparison, the numbers of false positive and false negative Markov pairs are calculated.

The cnCompare function returns an object with the following slots: 1) the number of true positive edges TP; 2) the number of false positive edges FP; 3) the number of false negative edges FN; 4) the F-score, which is the harmonic average of the specificity and sensitivity 5) the number of different elements in the corresponding parent matrices hamm; 6) the total number of different elements between all powers of the parent matrices hammexp;

Next three numbers identify the difference in the objects' skeletons (undirected graph structure)

7) the number of true positive undirected edges TP; 8) the number of false positive undirected edges FP; 9) the number of false negative undirected edges FN;

10) the number of false positive order pairs order.fp; 11) the number of false negative order pairs order.fn; 12) the number of false positive Markov pairs markov.fp; and 13) the number of false positive Markov pairs markov.fn. It is assumed that the first object represents the ground truth with respect to which the comparison is performed.

If extended is set off (FALSE) only the edge (TP, FP, FN) and skeleton (TP, FP, FN) numbers are reported, otherwise all distance parameters are calculated. Turning off the extended option is recommended for very large networks (e.g. with number of nodes > 500), since the calculation of some of the distance metrics involve matrix calculations for which the function is not optimized and can be very slow.

Value

A catNetworkDistance if object2 is catNetwork and catNetworkEvaluate otherwise.

Author(s)

N. Balov

See Also

catNetworkEvaluate-class

Examples

  cnet1 <- cnRandomCatnet(numnodes=10, maxParents=2, numCategories=2)
  cnet2 <- cnRandomCatnet(numnodes=10, maxParents=2, numCategories=2)
  dist <- cnCompare(object1=cnet1, object2=cnet2)
  dist

catnet documentation built on Nov. 10, 2022, 5:08 p.m.