Main module for inversion counting, hypothesis tests, and sequence
transformations. The exposed API of the package relies on the
implementations contained in this module.
Author: Benjamin D. Nye License: Apache License V2.0
float
|
_inversionComparisonTest(test,
classTest,
orderings,
orderings2=None,
seq=None,
isGraded=False,
hashableElements=True,
measure=' adaptive ' ,
**kwds)
A hypothesis test for comparing the similarity of some orderings
based on some test function (test) and its equivalent in the
GradedPosetSequence class (classTest). |
|
|
list of object or list of list of object
|
filterElements(sequence,
excludedElements,
isGraded=False)
Remove elements from a nested list, if they are part of the excluded
elements. |
|
|
int
|
getDefaultIndex(element,
maxIndex,
defaultGrade=None)
Get a default index for a missing element. |
|
|
object
|
getMedianValue(values)
Get the median of a sequence Each element of the sequence must be
able to be averaged (added and divided by a number) |
|
|
int
|
getValueIndex(value,
sequence,
isGraded=False,
defaultGrade=None)
Get the index of the given value in the sequence |
|
|
int
|
inversionCount(seq,
seq2=None,
isGraded=False,
hashableElements=True)
Calculate the inversions between seq and seq2. |
|
|
float
|
inversionCountCDF(seq,
seq2=None,
isGraded=False,
hashableElements=True,
cdfType=' adaptive ' )
Get the cummulative distribution function probability for the number
of inversions between seq and seq2. |
|
|
int
|
inversionCountMax(seq,
seq2=None,
isGraded=False,
hashableElements=True)
Calculate the maximum possible number of inversions, based on the
sequence (# of elements and grade structure). |
|
|
float
|
inversionCountMean(seq,
seq2=None,
isGraded=False,
hashableElements=True)
Calculate the mean inversions across permutations, based on the
sequence (# of elements and grade structure). |
|
|
float
|
inversionCountVariance(seq,
seq2=None,
isGraded=False,
hashableElements=True)
Calculate the variance of inversions across permutations, based on
the sequence (# of elements and grade structure). |
|
|
float
|
inversionPermutationMeanTest(orderings,
orderings2,
seq=None,
isGraded=False,
hashableElements=True,
measure=' adaptive ' ,
alternative=' greater ' ,
pValue=0.95,
iterations=100000,
useStoppingRule=True,
maxExactN=7)
Perform a Permutation or Monte Carlo Mean Difference Test on some
measure (similarity or 1-CDF) for the match between the each sequence
and the reference seq. |
|
|
float
|
inversionPermutationRankTest(orderings,
orderings2,
seq=None,
isGraded=False,
hashableElements=True,
measure=' adaptive ' ,
alternative=' greater ' ,
pValue=0.95,
iterations=100000,
useStoppingRule=True,
maxExactN=7)
Perform a Permutation or Monte Carlo Rank on some measure (similarity
or 1-CDF) for the match between the each sequence and the reference
seq. |
|
|
float
|
inversionSignTest(orderings,
orderings2=None,
seq=None,
isGraded=False,
hashableElements=True,
measure=' similarity ' ,
alternative=' greater ' ,
mu=0.5)
A sign test based on the values of some measure. |
|
|
float
|
inversionSimilarity(seq,
seq2=None,
isGraded=False,
hashableElements=True)
Calculate the similarity between sequences:
1-inversions/maxInversions If seq2 is None, this works equivalently
to seq2 being a sorted version of seq |
|
|
float
|
inversionWilcoxonTest(orderings,
orderings2=None,
seq=None,
isGraded=False,
hashableElements=True,
cdfType=' adaptive ' ,
alternative=' greater ' )
A Wilcoxon rank sum test based on the complement of the CDF (1-cdf). |
|
|
list of int
|
makeFlatIndexSequence(sequence,
referenceSequence,
isSeqNested=False,
isRefNested=False,
tieFunction=<built-in function sorted>,
indexFunction=<function getValueIndex at 0x05143FB0>)
Convert 'sequence' into a sequence of indices from the reference
sequence, Note: This flattens the sequence, if it was nested, for
inversion counting. |
|
|
list of list of int or list of int
|
makeIndexSequence(sequence,
referenceSequence,
isSeqNested=False,
isRefNested=False,
tieFunction=<built-in function sorted>,
indexFunction=<function getValueIndex at 0x05143FB0>)
Convert 'sequence' into a sequence of indices from the reference
sequence, rather than objects Note: This retains the original
sequence structure (so if the sequence was nested, it remains nested) |
|
|
list of list of object
|
medianSequence(permutations,
isGraded=False,
hashableElements=True)
From the given permutations, make a sequence ordered by the median
rank of each element. |
|
|
int, list
|
|
|
pairwiseGroupComparison(orderings,
orderings2,
isGraded=False,
hashableElements=True,
cdfType=' adaptive ' ,
alternative=' greater ' ) |
|
|