Exemplo n.º 1
0
def eval_skewness(data, param):
    logging.info("eval_skewness")
    exp_name = "eval_skewness"

    analyst = 6
    param.part_size = analyst
    param.ANALYST_COUNT = analyst * analyst
    fov_count = 200  # fixed

    skewness = [1.6, 1.8, 2.0, 2.2, 2.4]
    method_list = ["grid_standard", "quad_standard", "kd_standard"]

    res_cube_value = np.zeros((len(skewness), len(seed_list), len(method_list)))

    for j in range(len(seed_list)):
        param.seed = seed_list[j]
        for i in range(len(skewness)):
            param.ZIPFIAN_SKEW = skewness[i]
            for k in range(len(method_list)):
                if method_list[k] == "grid_standard":
                    tree = Grid_standard(data, param)
                elif method_list[k] == "quad_standard":
                    tree = Quad_standard(data, param)
                elif method_list[k] == "kd_standard":
                    tree = Kd_standard(data, param)
                else:
                    logging.error("No such index structure!")
                    sys.exit(1)
                tree.buildIndex()

                res_cube_value[i, j, k] = optimization(tree, fov_count, seed_list[j], param)

    res_value_summary = np.average(res_cube_value, axis=1)
    np.savetxt(param.resdir + exp_name + dataset_identifier, res_value_summary, fmt="%.4f\t")
Exemplo n.º 2
0
def eval_bandwidth(data, param):
    logging.info("eval_bandwidth")
    exp_name = "eval_bandwidth"

    analyst = 6
    param.part_size = analyst
    param.ANALYST_COUNT = analyst * analyst

    bandwidth = [10,15,20,25,30]
    method_list = ['grid_standard', 'quad_standard', 'kd_standard']

    res_cube_value = np.zeros((len(bandwidth), len(seed_list), len(method_list)))

    for j in range(len(seed_list)):
        param.seed = seed_list[j]
        for i in range(len(bandwidth)):
            for k in range(len(method_list)):
                if method_list[k] == 'grid_standard':
                    tree = Grid_standard(data, param)
                elif method_list[k] == 'quad_standard':
                    tree = Quad_standard(data, param)
                elif method_list[k] == 'kd_standard':
                    tree = Kd_standard(data, param)
                else:
                    logging.error('No such index structure!')
                    sys.exit(1)
                tree.buildIndex()

                answer = optimization(tree, bandwidth[i], seed_list[j], param)
                res_cube_value[i, j, k] = answer[0]

    res_value_summary = np.average(res_cube_value, axis=1)
    np.savetxt(param.resdir + exp_name + dataset_identifier, res_value_summary, fmt='%.4f\t')
Exemplo n.º 3
0
def eval_analyst(data, param):
    logging.info("eval_analyst")
    exp_name = "eval_analyst"

    analyst = [4,5,6,7,8]
    fov_count = 100    # fixed
    method_list = ['grid_standard', 'quad_standard', 'kd_standard']

    res_cube_value = np.zeros((len(analyst), len(seed_list), len(method_list)))

    for j in range(len(seed_list)):
        param.seed = seed_list[j]
        for i in range(len(analyst)):
            param.part_size = analyst[i]
            param.ANALYST_COUNT = analyst[i] * analyst[i]
            for k in range(len(method_list)):
                if method_list[k] == 'grid_standard':
                    tree = Grid_standard(data, param)
                elif method_list[k] == 'quad_standard':
                    tree = Quad_standard(data, param)
                elif method_list[k] == 'kd_standard':
                    tree = Kd_standard(data, param)
                else:
                    logging.error('No such index structure!')
                    sys.exit(1)
                tree.buildIndex()

                res_cube_value[i, j, k] = optimization(tree, fov_count, seed_list[j], param)

    res_value_summary = np.average(res_cube_value, axis=1)
    np.savetxt(param.resdir + exp_name + dataset_identifier , res_value_summary, fmt='%.4f\t')
Exemplo n.º 4
0
def eval_workload(data, param):
    logging.info("eval_workload")
    exp_name = "eval_workload"

    analyst = [4,5,6,7,8]
    method_list = ['grid_standard', 'quad_standard', 'kd_standard']

    res_cube_value = np.zeros((len(analyst), len(seed_list), len(method_list)))

    for j in range(len(seed_list)):
        param.seed = seed_list[j]
        for i in range(len(analyst)):
            param.part_size = analyst[i]
            param.ANALYST_COUNT = analyst[i] * analyst[i]
            for k in range(len(method_list)):
                if method_list[k] == 'grid_standard':
                    tree = Grid_standard(data, param)
                    tree.buildIndex()
                    leaf_boxes = getLeafNode(tree, 1)
                elif method_list[k] == 'quad_standard':
                    tree = Quad_standard(data, param)
                    tree.buildIndex()
                    leaf_boxes = getLeafNode(tree, 2)
                elif method_list[k] == 'kd_standard':
                    tree = Kd_standard(data, param)
                    tree.buildIndex()
                    leaf_boxes = getLeafNode(tree, 2)
                else:
                    logging.error('No such index structure!')
                    sys.exit(1)
                workload_counts = [leaf[1] for leaf in leaf_boxes]
                res_cube_value[i, j, k] = np.var(workload_counts)

    res_value_summary = np.average(res_cube_value, axis=1)
    np.savetxt(param.resdir + exp_name + dataset_identifier , res_value_summary, fmt='%.4f\t')
Exemplo n.º 5
0
def eval_runtime(data, param):
    logging.info("eval_runtime")
    exp_name = "eval_runtime"

    analyst = 6
    param.part_size = analyst
    param.ANALYST_COUNT = analyst * analyst
    bandwidth = 20    # fixed

    method_list = ['grid_standard', 'quad_standard', 'kd_standard']
    res_cube_value = np.zeros((2, len(seed_list), len(method_list)))

    for j in range(len(seed_list)):
        param.seed = seed_list[j]
        for k in range(len(method_list)):
            start = time.time()
            if method_list[k] == 'grid_standard':
                tree = Grid_standard(data, param)
            elif method_list[k] == 'quad_standard':
                tree = Quad_standard(data, param)
            elif method_list[k] == 'kd_standard':
                tree = Kd_standard(data, param)
            else:
                logging.error('No such index structure!')
                sys.exit(1)
            tree.buildIndex()
            partition_duration = time.time() - start

            answer = optimization(tree, bandwidth, seed_list[j], param)
            optimization_duration = time.time() - start - partition_duration

            res_cube_value[0, j, k] = partition_duration
            res_cube_value[1, j, k] = optimization_duration

    res_value_summary = np.average(res_cube_value, axis=1)
    np.savetxt(param.resdir + exp_name + dataset_identifier, res_value_summary, fmt='%.4f\t')