示例#1
0
def run_main(num_labels=None, split_idx=None, no_viz=None, configs=None, comm=None):
    import argparse
    import sys
    #print sys.argv
    parser = argparse.ArgumentParser()
    parser.add_argument('-num_labels', type=int)
    parser.add_argument('-split_idx', type=int)
    parser.add_argument('-no_viz', action='store_true')
    arguments = parser.parse_args(sys.argv[1:])
    if num_labels is not None:
        arguments.num_labels = num_labels
    if split_idx is not None:
        arguments.split_idx = split_idx
    if no_viz is not None:
        arguments.no_viz = no_viz

    configs_lib.comm = comm
    if test_mpi:
        from mpi4py import MPI
        print str(MPI.COMM_WORLD.Get_rank()) + '-' + str(arguments.num_labels) + '-' + str(arguments.split_idx)
        return

    configs_lib.arguments = arguments
    import warnings
    #print 'Ignoring Deprecation Warnings'
    warnings.filterwarnings("ignore",category=DeprecationWarning)

    from mpi4py import MPI
    comm = MPI.COMM_WORLD
    if MPI.COMM_WORLD.Get_size() > 1:
        if mpi_utility.is_group_master():
            print '(' + socket.gethostname() + ')''Process ' + str(comm.Get_rank()) + ': Starting experiments...'
    else:
        print 'Starting experiments...'
    if mpi_utility.is_group_master():
        timer.tic()
    if configs_lib.run_experiments:
        run_experiments(configs)
    if mpi_utility.is_group_master():
        timer.toc()
    if helper_functions.is_laptop():
        import winsound
        winsound.Beep(440, 1000)
    if helper_functions.is_laptop() and not arguments.no_viz and MPI.COMM_WORLD.Get_size() == 1:
        vis_configs = configs_lib.VisualizationConfigs()
        if vis_configs.vis_table:
            create_table()
        else:
            run_visualization()
示例#2
0
            bc.DATA_SYNTHETIC_CROSS,
        ]
    elif use_1d_data:
        data_sets_for_exps = all_1d
        #data_sets_for_exps = synthetic_data_sets
    else:
        data_sets_for_exps = real_data_sets_full
if plot_idx in {
        PLOT_TABLE_COMPETING_METHODS, PLOT_TABLE_OUR_METHODS,
        PLOT_TABLE_CONSTRAINED
}:
    names_for_table = all_1d_names + real_full_names
#data_sets_for_exps = real_data_sets_full

synthetic_dim = 1
if helper_functions.is_laptop():
    use_pool = False
    pool_size = 4
else:
    use_pool = False
    pool_size = 24
max_features = create_data_set.max_features
arguments = None


def apply_arguments(configs):
    if arguments.num_labels is not None:
        configs.overwrite_num_labels = arguments.num_labels
    if arguments.split_idx is not None:
        configs.split_idx = arguments.split_idx
data_sets_for_exps = [data_set_to_use]
if run_batch_exps:
    if use_sms_plot_data_sets:
        data_sets_for_exps = [
            bc.DATA_SYNTHETIC_STEP_LINEAR_TRANSFER,
            bc.DATA_SYNTHETIC_DELTA_LINEAR,
            bc.DATA_SYNTHETIC_CROSS,
        ]
    elif use_1d_data:
        data_sets_for_exps = all_1d
    else:
        data_sets_for_exps = real_data_sets_full
#data_sets_for_exps = real_data_sets_full

synthetic_dim = 1
if helper_functions.is_laptop():
    use_pool = False
    pool_size = 4
else:
    use_pool = False
    pool_size = 24
max_features = create_data_set.max_features
arguments = None
def apply_arguments(configs):
    if arguments.num_labels is not None:
        configs.overwrite_num_labels = arguments.num_labels
    if arguments.split_idx is not None:
        configs.split_idx = arguments.split_idx

class ProjectConfigs(bc.ProjectConfigs):
    def __init__(self, data_set=None, use_arguments=True, **kwargs):