Computes information gain of single feature and target vector.

1 | ```
calc_ig(feature, target_b, len_target, pos_target)
``` |

`feature` |
feature vector. |

`target_b` |
target in bits (as per |

`len_target` |
length of the target vector. |

`pos_target` |
number of positive cases in the target vector. |

The information gain term is used here (improperly) as a synonym of mutual information. It is defined as:

*IG(X; Y) = ∑_{y \in Y} ∑_{x \in X} p(x, y) \log ≤ft(\frac{p(x, y)}{p(x) p(y)} \right)*

In biogram package information gain is computed using following relationship:
*IG = E(S) - E(S|F)*

A `numeric`

vector of length 1 representing information gain in nats.

During calculations *0 \log 0 = 0*. For a justification see References.

The function was designed to be as fast as possible subroutine of
`calc_criterion`

and might be cumbersome if directly called by a user.

Cover TM, Thomas JA *Elements of Information Theory, 2nd Edition*
Wiley, 2006.

1 2 3 4 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.