Example #1
0
def Test(pdfList):
        print pdfMax(pdfList, 0.1)

        if len(pdfList) > 2:
                for i in range(11):
                        significance = 10.0 ** -i
                        print pdfMax(pdfList, significance)
Example #2
0
significance = float(sys.argv[1])

nStats = {}

for line in sys.stdin:
    testcase = json.loads(line)

    pdfList = [(item['mu'], item['sigma']) for item in testcase['input']]

    refMu = testcase['expect']['mu']
    refSigma = testcase['expect']['sigma']
    refOdds = testcase['expect']['odds']

    n = len(pdfList)

    mu, sigma, odds = pdfmax.pdfMax(pdfList, significance)

    muError = abs(mu - refMu)
    sigmaError = abs(sigma - refSigma)
    oddsErrors = [abs(o - oref) for o, oref in zip(odds, refOdds)]

    if n not in nStats:
        nStats[n] = [stats.Stats(), stats.Stats(), stats.Stats()]

    nStats[n][0].add(muError)
    nStats[n][1].add(sigmaError)
    for oddsError in oddsErrors:
        nStats[n][2].add(oddsError)

maxList = [float('-inf')] * 9
count1, count2 = 0, 0
Example #3
0
significance = float(sys.argv[1])

nStats = {}

for line in sys.stdin:
    testcase = json.loads(line)

    pdfList = [(item["mu"], item["sigma"]) for item in testcase["input"]]

    refMu = testcase["expect"]["mu"]
    refSigma = testcase["expect"]["sigma"]
    refOdds = testcase["expect"]["odds"]

    n = len(pdfList)

    mu, sigma, odds = pdfmax.pdfMax(pdfList, significance)

    muError = abs(mu - refMu)
    sigmaError = abs(sigma - refSigma)
    oddsErrors = [abs(o - oref) for o, oref in zip(odds, refOdds)]

    if n not in nStats:
        nStats[n] = [stats.Stats(), stats.Stats(), stats.Stats()]

    nStats[n][0].add(muError)
    nStats[n][1].add(sigmaError)
    for oddsError in oddsErrors:
        nStats[n][2].add(oddsError)

maxList = [float("-inf")] * 9
count1, count2 = 0, 0