ML.InfoTheory.BitRank

Package ML :: Package InfoTheory :: Module BitRank |
[hide private]
[frames] | no frames]

# Module BitRank

source code

    Functionality for ranking bits using info gains

    **Definitions used in this module**

       - *sequence*: an object capable of containing other objects which supports
         __getitem__() and __len__().  Examples of these include lists, tuples, and
         Numeric arrays.

       - *IntVector*: an object containing integers which supports __getitem__() and
          __len__(). Examples include lists, tuples, Numeric Arrays, and BitVects.

    **NOTE**: Neither *sequences* nor *IntVectors* need to support item assignment.
      It is perfectly acceptable for them to be read-only, so long as they are
      random-access.

Functions | [hide private]
FormCounts(bitVects, actVals, whichBit, nPossibleActs, nPossibleBitVals=2) generates the counts matrix for a particular bit **Arguments** - bitVects: a *sequence* containing *IntVectors* - actVals: a *sequence* - whichBit: an integer, the bit number to use. | source code
CalcInfoGains(bitVects, actVals, nPossibleActs, nPossibleBitVals=2) Calculates the information gain for a set of points and activity values **Arguments** - bitVects: a *sequence* containing *IntVectors* - actVals: a *sequence* - nPossibleActs: the (integer) number of possible activity values. | source code
RankBits(bitVects, actVals, nPossibleBitVals=2, metricFunc=<function CalcInfoGains at 0x9f7a2cc>) Rank a set of bits according to a metric function **Arguments** - bitVects: a *sequence* containing *IntVectors* - actVals: a *sequence* - nPossibleBitVals: (optional) if specified, this integer provides the maximum value attainable by the (increasingly inaccurately named) bits in _bitVects_. | source code
AnalyzeSparseVects(bitVects, actVals) #DOC ... | source code
SparseRankBits(bitVects, actVals, metricFunc=<function AnalyzeSparseVects at 0x9f7a224>) Rank a set of bits according to a metric function **Arguments** - bitVects: a *sequence* containing SBVs - actVals: a *sequence* - metricFunc: (optional) the metric function to be used. | source code

Variables | [hide private]
| Complex0 = ``'``F``'``
| Complex16 = ``'``F``'``
| Complex32 = ``'``F``'``
| Complex64 = ``'``D``'``
| Complex8 = ``'``F``'``
| Float0 = ``'``f``'``
| Float16 = ``'``f``'``
| Float32 = ``'``f``'``
| Float64 = ``'``d``'``
| Float8 = ``'``f``'``
| Int0 = ``'``1``'``
| Int16 = ``'``s``'``
| Int32 = ``'``i``'``
| Int8 = ``'``1``'``
| absolute = `<ufunc 'absolute'>`
| add = `<ufunc 'add'>`
| arccos = `<ufunc 'arccos'>`
| arccosh = `<ufunc 'arccosh'>`
| arcsin = `<ufunc 'arcsin'>`
| arcsinh = `<ufunc 'arcsinh'>`
| arctan = `<ufunc 'arctan'>`
| arctan2 = `<ufunc 'arctan2'>`
| arctanh = `<ufunc 'arctanh'>`
| bitwise_and = `<ufunc 'bitwise_and'>`
| bitwise_or = `<ufunc 'bitwise_or'>`
| bitwise_xor = `<ufunc 'bitwise_xor'>`
| ceil = `<ufunc 'ceil'>`
| conjugate = `<ufunc 'conjugate'>`
| cos = `<ufunc 'cos'>`
| cosh = `<ufunc 'cosh'>`
| divide = `<ufunc 'divide'>`
| divide_safe = `<ufunc 'divide_safe'>`
| e = `2.71828182846`
| equal = `<ufunc 'equal'>`
| exp = `<ufunc 'exp'>`
| fabs = `<ufunc 'fabs'>`
| floor = `<ufunc 'floor'>`
| floor_divide = `<ufunc 'floor_divide'>`
| fmod = `<ufunc 'fmod'>`
| greater = `<ufunc 'greater'>`
| greater_equal = `<ufunc 'greater_equal'>`
| hypot = `<ufunc 'hypot'>`
| invert = `<ufunc 'invert'>`
| left_shift = `<ufunc 'left_shift'>`
| less = `<ufunc 'less'>`
| less_equal = `<ufunc 'less_equal'>`
| log = `<ufunc 'log'>`
| log10 = `<ufunc 'log10'>`
| logical_and = `<ufunc 'logical_and'>`
| logical_not = `<ufunc 'logical_not'>`
| logical_or = `<ufunc 'logical_or'>`
| logical_xor = `<ufunc 'logical_xor'>`
| maximum = `<ufunc 'maximum'>`
| minimum = `<ufunc 'minimum'>`
| multiply = `<ufunc 'multiply'>`
| negative = `<ufunc 'negative'>`
| not_equal = `<ufunc 'not_equal'>`
| pi = `3.14159265359`
| power = `<ufunc 'power'>`
| remainder = `<ufunc 'remainder'>`
| right_shift = `<ufunc 'right_shift'>`
| sin = `<ufunc 'sin'>`
| sinh = `<ufunc 'sinh'>`
| sqrt = `<ufunc 'sqrt'>`
| subtract = `<ufunc 'subtract'>`
| tan = `<ufunc 'tan'>`
| tanh = `<ufunc 'tanh'>`
| true_divide = `<ufunc 'true_divide'>`

Function Details | [hide private]

### FormCounts(bitVects, actVals, whichBit, nPossibleActs, nPossibleBitVals=2) | source code
    generates the counts matrix for a particular bit

    **Arguments**

      - bitVects: a *sequence* containing *IntVectors*

      - actVals: a *sequence*

      - whichBit: an integer, the bit number to use.

      - nPossibleActs: the (integer) number of possible activity values.

      - nPossibleBitVals: (optional) if specified, this integer provides the maximum
        value attainable by the (increasingly inaccurately named) bits in _bitVects_.

    **Returns**

      a Numeric array with the counts

    **Notes**

      This is really intended for internal use.

### CalcInfoGains(bitVects, actVals, nPossibleActs, nPossibleBitVals=2) | source code
    Calculates the information gain for a set of points and activity values

    **Arguments**

      - bitVects: a *sequence* containing *IntVectors*

      - actVals: a *sequence*

      - nPossibleActs: the (integer) number of possible activity values.

      - nPossibleBitVals: (optional) if specified, this integer provides the maximum
        value attainable by the (increasingly inaccurately named) bits in _bitVects_.

     **Returns**

       a list of floats

### RankBits(bitVects, actVals, nPossibleBitVals=2, metricFunc=<function CalcInfoGains at 0x9f7a2cc>) | source code
    Rank a set of bits according to a metric function

    **Arguments**

      - bitVects: a *sequence* containing *IntVectors*

      - actVals: a *sequence*

      - nPossibleBitVals: (optional) if specified, this integer provides the maximum
        value attainable by the (increasingly inaccurately named) bits in _bitVects_.

      - metricFunc: (optional) the metric function to be used.  See _CalcInfoGains()_
        for a description of the signature of this function.

     **Returns**

       A 2-tuple containing:

         - the relative order of the bits (a list of ints)

         - the metric calculated for each bit (a list of floats)

### AnalyzeSparseVects(bitVects, actVals) | source code
    #DOC

    **Arguments**

      - bitVects: a *sequence* containing SBVs

      - actVals: a *sequence*

     **Returns**

       a list of floats

     **Notes**

        - these need to be bit vects and binary activities

### SparseRankBits(bitVects, actVals, metricFunc=<function AnalyzeSparseVects at 0x9f7a224>) | source code
    Rank a set of bits according to a metric function

    **Arguments**

      - bitVects: a *sequence* containing SBVs

      - actVals: a *sequence*

      - metricFunc: (optional) the metric function to be used.  See _SparseCalcInfoGains()_
        for a description of the signature of this function.

     **Returns**

       A 2-tuple containing:

         - the relative order of the bits (a list of ints)

         - the metric calculated for each bit (a list of floats)

      **Notes**

        - these need to be bit vects and binary activities