def test_cuboids(lb, ub, RVstart, RVend, cuboid_volume): probmass = [] subdiams = [] tot_diam = [] solved_p = [] # subdivisions for i in range(len(lb)): if DEBUG: print("\n") print(" lower bounds: %s" % lb[i]) print(" upper bounds: %s" % ub[i]) if i in NEW_SLICES or not NEW_SLICES: subcuboid_volume = volume(lb[i], ub[i]) sub_prob_mass = prob_mass(subcuboid_volume, cuboid_volume) probmass.append(sub_prob_mass) if DEBUG: print(" probability mass: %s" % sub_prob_mass) solved, diameter, subdiameters = UQ(RVstart, RVend, lb[i], ub[i]) solved_p.append(solved) subdiams.append(subdiameters) tot_diam.append(diameter) else: probmass.append(PROBABILITY_MASS[i]) if DEBUG: print(" probability mass: %s" % PROBABILITY_MASS[i]) solved_p.append(SOLVED_PARAMETERS[i]) subdiams.append(SUB_DIAMETERS[i]) tot_diam.append(TOTAL_DIAMETERS[i]) return solved_p, subdiams, tot_diam, probmass
def test_cuboids(lb, ub, RVstart, RVend, cuboid_volume): probmass = [] subdiams = [] tot_diam = [] solved_p = [] # subdivisions for i in range(len(lb)): if DEBUG: print "\n" print " lower bounds: %s" % lb[i] print " upper bounds: %s" % ub[i] if i in NEW_SLICES or not NEW_SLICES: subcuboid_volume = volume(lb[i], ub[i]) sub_prob_mass = prob_mass(subcuboid_volume, cuboid_volume) probmass.append(sub_prob_mass) if DEBUG: print " probability mass: %s" % sub_prob_mass solved, diameter, subdiameters = UQ(RVstart, RVend, lb[i], ub[i]) solved_p.append(solved) subdiams.append(subdiameters) tot_diam.append(diameter) else: probmass.append(PROBABILITY_MASS[i]) if DEBUG: print " probability mass: %s" % PROBABILITY_MASS[i] solved_p.append(SOLVED_PARAMETERS[i]) subdiams.append(SUB_DIAMETERS[i]) tot_diam.append(TOTAL_DIAMETERS[i]) return solved_p, subdiams, tot_diam, probmass
print(" model: f(x) = %s(x)" % function_name) param_string = "[" for i in range(RVmax): param_string += "'x%s'" % str(i + 1) if i == (RVmax - 1): param_string += "]" else: param_string += ", " print(" parameters: %s" % param_string) print(" lower bounds: %s" % lower_bounds) print(" upper bounds: %s" % upper_bounds) # print(" ...") #cuboid_volume = volume(lower_bounds,upper_bounds) cuboid_volume = volume(lbounds, ubounds) probability_mass = prob_mass(cuboid_volume, cuboid_volume) print(" probability mass: %s" % probability_mass) expectation = expectation_value(model, lower_bounds, upper_bounds) print(" expectation: %s" % expectation) mean_value = mean(expectation, cuboid_volume) print(" mean value: %s" % mean_value) diameter = UQ(RVstart, RVend, lower_bounds, upper_bounds) mcdiarmid = mcdiarmid_bound(mean_value, sqrt(diameter)) print("McDiarmid bound: %s" % mcdiarmid) #if RVstart != 0 or RVend != 2: # abort when not a 3-D problem # break #FIXME: break? or exit? or pass/else? or ??? weighted_bound = [] sanity = [] lb = []
print " model: f(x) = %s(x)" % function_name param_string = "[" for i in range(RVmax): param_string += "'x%s'" % str(i+1) if i == (RVmax - 1): param_string += "]" else: param_string += ", " print " parameters: %s" % param_string print " lower bounds: %s" % lower_bounds print " upper bounds: %s" % upper_bounds # print " ..." #cuboid_volume = volume(lower_bounds,upper_bounds) cuboid_volume = volume(lbounds,ubounds) probability_mass = prob_mass(cuboid_volume,cuboid_volume) print " probability mass: %s" % probability_mass expectation = expectation_value(model,lower_bounds,upper_bounds) print " expectation: %s" % expectation mean_value = mean(expectation,cuboid_volume) print " mean value: %s" % mean_value diameter = UQ(RVstart,RVend,lower_bounds,upper_bounds) mcdiarmid = mcdiarmid_bound(mean_value,sqrt(diameter)) print "McDiarmid bound: %s" % mcdiarmid #if RVstart != 0 or RVend != 2: # abort when not a 3-D problem # break #FIXME: break? or exit? or pass/else? or ??? weighted_bound = [] sanity = [] lb = []