ML.MLUtils.VoteImg

Package ML :: Package MLUtils :: Module VoteImg |
[hide private]
[frames] | no frames]

# Module VoteImg

source code

    functionality for generating an image showing the results of a composite model voting on a data set

    Uses *Numeric* and *PIL*

Functions | [hide private]
CollectVotes(composite, data, badOnly) collects the votes from _composite_ for the examples in _data_ **Arguments** - composite: a composite model - data: a list of examples to run through _composite_ - badOnly: if set only bad (misclassified) examples will be kept **Returns** a 4-tuple containing: 1) the expanded list of vote details (see below) 2) the list of predicted results 3) the list of true results 4) the number of miscounted examples **Notes** pp - the expanded list of vote details consists of: '[ vote1, vote2, ... | source code
BuildVoteImage(nModels, data, values, trueValues=`[``]`, sortTrueVals=0, xScale=10, yScale=2, addLine=1) constructs the actual image... | source code
VoteAndBuildImage(composite, data, badOnly=0, sortTrueVals=0, xScale=10, yScale=2, addLine=1) collects votes on the examples and constructs an image... | source code
Usage() provides a list of arguments for when this is used from the command line... | 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]

### CollectVotes(composite, data, badOnly) | source code
    collects the votes from _composite_ for the examples in _data_

        **Arguments**

          - composite: a composite model

          - data: a list of examples to run through _composite_

          - badOnly: if set only bad (misclassified) examples will be kept

        **Returns**

          a 4-tuple containing:

            1) the expanded list of vote details (see below)

            2) the list of predicted results

            3) the list of true results

            4) the number of miscounted examples

        **Notes**

    pp      - the expanded list of vote details consists of:

            '[ vote1, vote2, ... voteN, 0, res, trueRes]'

            where _res_ is the predicted results and _trueRes_ is the actual result.
            The extra zero is included to allow a line to be drawn between the votes
            and the results.

### BuildVoteImage(nModels, data, values, trueValues=`[``]`, sortTrueVals=0, xScale=10, yScale=2, addLine=1) | source code
    constructs the actual image

    **Arguments**

      - nModels: the number of models in the composite

      - data: the results of voting

      - values: predicted values for each example

      - trueValues: true values for each example

      - sortTrueVals: if nonzero the votes will be sorted so
        that the _trueValues_ are in order, otherwise the sort
        is by _values_

      - xScale: number of pixels per vote in the x direction

      - yScale: number of pixels per example in the y direction

      - addLine: if nonzero, a purple line is drawn separating
         the votes from the examples

    **Returns**

      a PIL image

### VoteAndBuildImage(composite, data, badOnly=0, sortTrueVals=0, xScale=10, yScale=2, addLine=1) | source code
    collects votes on the examples and constructs an image

    **Arguments**

      - composte: a composite model

      - data: the examples to be voted upon

      - badOnly: if nonzero only the incorrect votes will be shown

      - sortTrueVals: if nonzero the votes will be sorted so
        that the _trueValues_ are in order, otherwise the sort
        is by _values_

      - xScale: number of pixels per vote in the x direction

      - yScale: number of pixels per example in the y direction

      - addLine: if nonzero, a purple line is drawn separating
         the votes from the examples

    **Returns**

      a PIL image

### Usage() | source code
    provides a list of arguments for when this is used from the command line