Exemple #1
0
def training_model_1(train_rot=True):
    print("model 1")
    fitness_funcs = [
        fn.Fitness("polygon overlay", fn.norm_overlap_pc,
                   fn.Fitness_Relation.pairwise_parent_child, 32,
                   training_params.fitness_cap,
                   training_params.fitness_regr_cond)
    ]
    model = tm.model_var_pos()
    if train_rot:
        sibling_var_names = ["position", "rotation"]
    else:
        sibling_var_names = ["position"]
    parent_var_names = ["shape0"]

    return training(model=model,
                    fitness_funcs=fitness_funcs,
                    sibling_var_names=sibling_var_names,
                    parent_var_names=parent_var_names)
Exemple #2
0
def training_model_5(train_pos=True):
    print("model 5")
    fitness_funcs = [
        fn.Fitness("side alignment", fn.rotation_alignment_sb,
                   fn.Fitness_Relation.pairwise_siblings, 1,
                   training_params.fitness_cap,
                   training_params.fitness_regr_cond)
    ]
    model = tm.model_var_rot()
    if train_pos:
        sibling_var_names = ["rotation", "position"]
    else:
        sibling_var_names = ["rotation"]
    parent_var_names = ["shape0"]

    return training(model=model,
                    fitness_funcs=fitness_funcs,
                    sibling_var_names=sibling_var_names,
                    parent_var_names=parent_var_names)
Exemple #3
0
def training_model_3(train_size=True):
    print("model 3")

    fitness_funcs = [
        fn.Fitness("centroid difference", fn.centroid_dist_absolute,
                   fn.Fitness_Relation.absolute, 1,
                   training_params.fitness_cap,
                   training_params.fitness_regr_cond)
    ]
    #hierarchy,var_rot,var_nr_children)
    model = tm.model_var_size()
    if train_size:
        sibling_var_names = ["size", "position"]
    else:
        sibling_var_names = ["position"]
    parent_var_names = ["shape2", "shape4"]

    return training(model=model,
                    fitness_funcs=fitness_funcs,
                    sibling_var_names=sibling_var_names,
                    parent_var_names=parent_var_names)
Exemple #4
0
def fitness_order_MO_test():
    training_params.title = "test for fitness order, fitness target distance, polgygon overlay"
    print_params.verbose_iter = True
    print_params.verbose_final_extra = True

    for fo0 in range(4, 32, 4):
        for fo1 in range(4, 32, 4):
            print("fitness orders TD PO:", fo0, fo1)
            training_params.extra_info = "TD order: " + str(
                fo0) + "  PO order: " + str(fo1)
            fitness_funcs = [
                fn.Targetting_Fitness("Target distances",
                                      fn.min_dist_sb,
                                      fn.Fitness_Relation.pairwise_siblings,
                                      fo0,
                                      0,
                                      1,
                                      target=2),
                fn.Fitness("polygon overlay", fn.norm_overlap_pc,
                           fn.Fitness_Relation.pairwise_parent_child, fo1, 0,
                           1)
            ]
            #hierarchy,var_rot,var_nr_children)
            model = tm.model_var_pos(False)
            sibling_var_names = ["position"]

            parent_var_names = ["shape0"]

            try:
                training(model=model,
                         fitness_funcs=fitness_funcs,
                         sibling_var_names=sibling_var_names,
                         parent_var_names=parent_var_names)
            except KeyboardInterrupt:
                raise
            except Exception as e:
                print(e)
    print_train_parameters()
    training_params.reset()