module documentation

Undocumented

Function accuracy Given a list of reference values and a corresponding list of test values, return the fraction of corresponding values that are equal. In particular, return the fraction of indices 0<i<=len(test) such that ...
Function approxrand Returns an approximate significance level between two lists of independently generated test values.
Function demo Undocumented
Function f_measure Given a set of reference values and a set of test values, return the f-measure of the test values, when compared against the reference values. The f-measure is the harmonic mean of the precision and recall...
Function log_likelihood Given a list of reference values and a corresponding list of test probability distributions, return the average log likelihood of the reference values, given the probability distributions.
Function precision Given a set of reference values and a set of test values, return the fraction of test values that appear in the reference set. In particular, return card(reference intersection test)/card(test). If test...
Function recall Given a set of reference values and a set of test values, return the fraction of reference values that appear in the test set. In particular, return card(reference intersection test)/card(reference). If ...
def accuracy(reference, test): (source)

Given a list of reference values and a corresponding list of test values, return the fraction of corresponding values that are equal. In particular, return the fraction of indices 0<i<=len(test) such that test[i] == reference[i].

Parameters
reference:listAn ordered list of reference values.
test:listA list of values to compare against the corresponding reference values.
Raises
ValueErrorIf reference and length do not have the same length.
def approxrand(a, b, **kwargs): (source)

Returns an approximate significance level between two lists of independently generated test values.

Approximate randomization calculates significance by randomly drawing from a sample of the possible permutations. At the limit of the number of possible permutations, the significance level is exact. The approximate significance level is the sample mean number of times the statistic of the permutated lists varies from the actual statistic of the unpermuted argument lists.

Parameters
a:lista list of test values
b:listanother list of independently generated test values
**kwargsUndocumented
Returns
tuplea tuple containing an approximate significance level, the count of the number of times the pseudo-statistic varied from the actual statistic, and the number of shuffles
def demo(): (source)

Undocumented

def f_measure(reference, test, alpha=0.5): (source)

Given a set of reference values and a set of test values, return the f-measure of the test values, when compared against the reference values. The f-measure is the harmonic mean of the precision and recall, weighted by alpha. In particular, given the precision p and recall r defined by:

  • p = card(reference intersection test)/card(test)
  • r = card(reference intersection test)/card(reference)

The f-measure is:

  • 1/(alpha/p + (1-alpha)/r)

If either reference or test is empty, then f_measure returns None.

Parameters
reference:setA set of reference values.
test:setA set of values to compare against the reference set.
alphaUndocumented
Returns
float or NoneUndocumented
def log_likelihood(reference, test): (source)

Given a list of reference values and a corresponding list of test probability distributions, return the average log likelihood of the reference values, given the probability distributions.

Parameters
reference:listA list of reference values
test:list(ProbDistI)A list of probability distributions over values to compare against the corresponding reference values.
def precision(reference, test): (source)

Given a set of reference values and a set of test values, return the fraction of test values that appear in the reference set. In particular, return card(reference intersection test)/card(test). If test is empty, then return None.

Parameters
reference:setA set of reference values.
test:setA set of values to compare against the reference set.
Returns
float or NoneUndocumented
def recall(reference, test): (source)

Given a set of reference values and a set of test values, return the fraction of reference values that appear in the test set. In particular, return card(reference intersection test)/card(reference). If reference is empty, then return None.

Parameters
reference:setA set of reference values.
test:setA set of values to compare against the reference set.
Returns
float or NoneUndocumented