# In This Space

# Question

What is the math behind **Contingency Table Fit (CTF)** and **Deviance**?

# Answer

The CTF measures the quality of the representation of the Joint Probability Distribution by your network (with respect to the fully connected network).

**Contingency Table Fit**

BayesiaLab's CTF is defined as:

where

is the entropy of the data with the fully unconnected network *U*

is the entropy of the data with the evaluated network *B*

is the entropy of the data with the fully connected network *F*

The fully connected network is a graph in which all nodes have a direct link with all other ones. Therefore, this is the exact representation of the chain rule, without any conditional independence assumptions utilized for representing the joint probability distribution.

*C*is equal to 100 when the joint probability distribution is represented without any approximation, i.e. the same data entropy as the one obtained with the fully connected network*C*is equal to 0 when the joint probability distribution is represented by considering that all the variables are independent, i.e. data entropy as the one obtained with the fully unconnected network

*C* can also be negative, if the parameters of the *B* do not correspond to the dataset.

**Deviance**

Deviance is defined as:

where *N* is the size of the dataset.

**Example**

The **Contingency Table Fit (CTF)** and **Deviance** can be computed for the current network by evaluating its overall performance (**Analysis | Network Performance | Overall**).

This page has no comments.