Example #1
0
priors = ["Gauss(%f,%f)" % (m, m), "Gauss(%f,%f)" % (w, w*2), "Beta(2,50)",
"Beta(1,50)"]


#print 'foo'
#print sfi.mapestimate(data, nafc=model['nafc'], sigmoid=model['sigmoid'], core=model['core'], priors=priors)
#

def print_data(data):
    print "======================================================================"
    for dat in data:
        print dat[0], dat[1], dat[2]


def run():
    ob = po.Observer(*params, **model)
    data = ob.DoAnExperiment(levels, nblocks)
    Bi = pp.BayesInference(data, sigmoid=model['sigmoid'], core=model['core'],
            nafc=model['nafc'], priors=priors, verbose=True)

    ci = Bi.getCI(cut=0.5)
    if ci[0] - ci[2] == 0:
        print "warning, confidence interval has zero length!"
        print_data(data)

for i in range(1000):
    pp.set_seed(i) 
    print "iteration: ", i,
    run()
Example #2
0
#print sfi.mapestimate(data, nafc=model['nafc'], sigmoid=model['sigmoid'], core=model['core'], priors=priors)
#


def print_data(data):
    print "======================================================================"
    for dat in data:
        print dat[0], dat[1], dat[2]


def run():
    ob = po.Observer(*params, **model)
    data = ob.DoAnExperiment(levels, nblocks)
    Bi = pp.BayesInference(data,
                           sigmoid=model['sigmoid'],
                           core=model['core'],
                           nafc=model['nafc'],
                           priors=priors,
                           verbose=True)

    ci = Bi.getCI(cut=0.5)
    if ci[0] - ci[2] == 0:
        print "warning, confidence interval has zero length!"
        print_data(data)


for i in range(1000):
    pp.set_seed(i)
    print "iteration: ", i,
    run()
Example #3
0
def check_int(value):
    try:
        int(value)
        return True
    except ValueError:
        return False

if options.seed not in ["fixed", "time"] and not check_int(options.seed):
    raise ValueError("'seed' must be either 'fixed', 'time' or an integer value.")
elif options.seed == 'fixed':
    print "Seed is default."
elif options.seed == 'time':
    seed = int(time.time())
    print "Seed is time since epoch in seconds: '%d'" % seed
    pypsignifit.set_seed(seed)
    options.seed = seed
else:
    seed = int(options.seed)
    print "Seeed is value given on command line: '%d'" % seed
    pypsignifit.set_seed(seed)

# check that there is something to do
bayes = options.bayes
nonparametric = options.nonparametric
parametric = options.parametric
if not nonparametric and not parametric and not bayes:
    raise ValueError("You must specify one of: 'nonparametric', 'parametric' "+\
            "'bayes' in order for this script to do anything!")

# set the version
Example #4
0
    try:
        int(value)
        return True
    except ValueError:
        return False


if options.seed not in ["fixed", "time"] and not check_int(options.seed):
    raise ValueError(
        "'seed' must be either 'fixed', 'time' or an integer value.")
elif options.seed == 'fixed':
    print "Seed is default."
elif options.seed == 'time':
    seed = int(time.time())
    print "Seed is time since epoch in seconds: '%d'" % seed
    pypsignifit.set_seed(seed)
    options.seed = seed
else:
    seed = int(options.seed)
    print "Seeed is value given on command line: '%d'" % seed
    pypsignifit.set_seed(seed)

# check that there is something to do
bayes = options.bayes
nonparametric = options.nonparametric
parametric = options.parametric
if not nonparametric and not parametric and not bayes:
    raise ValueError("You must specify one of: 'nonparametric', 'parametric' "+\
            "'bayes' in order for this script to do anything!")

# set the version