Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Makes a cdf from an unsorted sequence of (value, frequency) pairs.

Args:
    items: unsorted sequence of (value, frequency) pairs
    name: string name for this CDF

Returns:
    cdf: list of (value, fraction) pairs

        def MakeCdfFromItems(items, name=''):
    """Makes a cdf from an unsorted sequence of (value, frequency) pairs.

    Args:
        items: unsorted sequence of (value, frequency) pairs
        name: string name for this CDF

    Returns:
        cdf: list of (value, fraction) pairs
    """
    runsum = 0
    xs = []
    cs = []

    for value, count in sorted(items):
        runsum += count
        xs.append(value)
        cs.append(runsum)

    total = float(runsum)
    ps = [c/total for c in cs]

    cdf = Cdf(xs, ps, name)
    return cdf
        


src/p/y/PyCritters-HEAD/critters/neural.py   PyCritters(Download)
    parameters specified (should yield random parameters).
    """
    cdf = Cdf.MakeCdfFromItems((t, t.FREQUENCY) for t in nodeTypes(**kwgs))
    return [cdf.Random()() for _ in range(n)]