def run_probabilistic_tests(): num_samples=1e4 max_p_value = 1e-4 for i in range(1,6): #note: this path should be with respect to the daphne path! ast = daphne(['desugar', '-i', '../CS532-HW2/programs/tests/probabilistic/test_{}.daphne'.format(i)]) truth = load_truth('programs/tests/probabilistic/test_{}.truth'.format(i)) stream = get_stream(ast) p_val = run_prob_test(stream, truth, num_samples) print('p value', p_val) assert(p_val > max_p_value) print('All probabilistic tests passed')
def run_probabilistic_tests(): num_samples=1e4 max_p_value = 1e-2 for i in range(1,7): exp = daphne(['desugar-hoppl', '-i', '../HW5/programs/tests/probabilistic/test_{}.daphne'.format(i)]) truth = load_truth('programs/tests/probabilistic/test_{}.truth'.format(i)) stream = get_stream(exp) p_val = run_prob_test(stream, truth, num_samples) print('p value', p_val) assert(p_val > max_p_value) print('Probabilistic Test '+str(i)+' passed') print('All probabilistic tests passed')
def run_probabilistic_tests(): #TODO: num_samples = 1e4 max_p_value = 1e-4 for i in range(1, 7): #for i in range(6,7): # Note: this path should be with respect to the daphne path! # ast = daphne(['graph', '-i', f'{daphne_path}/src/programs/tests/probabilistic/test_{i}.daphne']) # ast_path = f'./jsons/graphs/probabilistic/test_{i}.json' # with open(ast_path, 'w') as fout: # json.dump(ast, fout, indent=2) ast_path = f'./jsons/graphs/probabilistic/test_{i}.json' with open(ast_path) as json_file: graph = json.load(json_file) # print(graph) stream = get_stream(graph) # samples = [] # for k in range(1): # samples.append(next(stream)) # print(samples) # if i != 4: print('Running graph-based-sampling for probabilistic test number {}:'. format(str(i))) truth = load_truth( './programs/tests/probabilistic/test_{}.truth'.format(i)) # print(truth) p_val = run_prob_test(stream, truth, num_samples) print('p value', p_val) try: assert (p_val > max_p_value) except AssertionError: print('Test Failed\n') continue print('Test passed\n') print('All probabilistic tests passed.')
def run_probabilistic_tests(): num_samples = 1e4 #num_samples=10 max_p_value = 1e-4 for i in range(1, 7): #for i in range(6,7): # Note: this path should be with respect to the daphne path! # ast = daphne(['desugar', '-i', f'{daphne_path}/src/programs/tests/probabilistic/test_{i}.daphne']) # ast_path = f'./jsons/tests/probabilistic/test_{i}.json' # with open(ast_path, 'w') as fout: # json.dump(ast, fout, indent=2) ast_path = f'./jsons/tests/probabilistic/test_{i}.json' with open(ast_path) as json_file: ast = json.load(json_file) # print(ast) stream = get_stream(ast) # samples = [] # for k in range(1): # samples.append(next(stream)) # print(samples) print( 'Running evaluation-based-sampling for probabilistic test number {}:' .format(str(i))) truth = load_truth( './programs/tests/probabilistic/test_{}.truth'.format(i)) p_val = run_prob_test(stream, truth, num_samples) # Empty globals funcs rho = {} assert (p_val > max_p_value) print('P-Value: ', p_val) print('Test passed \n') print('All probabilistic tests passed.')
def run_probabilistic_tests(): num_samples = 1e4 max_p_value = 1e-2 for i in range(1, 7): exp = daphne([ 'desugar-hoppl', '-i', '/home/bigboi/Desktop/Prob_Prog_Course/CS532-HW5/programs/tests/probabilistic/test_{}.daphne' .format(i) ]) truth = load_truth( 'programs/tests/probabilistic/test_{}.truth'.format(i)) print("exp", exp, "truth", truth) stream = get_stream(exp) p_val = run_prob_test(stream, truth, num_samples) print('p value', p_val) assert (p_val > max_p_value) print('All probabilistic tests passed')
def run_probabilistic_tests(): #TODO: num_samples = 1e4 max_p_value = 1e-4 for i in range(1, 7): #note: this path should be with respect to the daphne path! graph = daphne([ 'graph', '-i', '../HW3/programs/tests/probabilistic/test_{}.daphne'.format(i) ]) truth = load_truth( 'programs/tests/probabilistic/test_{}.truth'.format(i)) stream = get_stream(graph) p_val = run_prob_test(stream, truth, num_samples) print('p value', p_val) print(p_val > max_p_value) print('All probabilistic tests passed')