Exemple #1
0
def _run_smac(tmp_dir, basename, time_for_task, ml_memory_limit,
              data_manager_path, configspace_path, initial_configurations,
              per_run_time_limit, watcher, log_function):
    task_name = 'runSmac'
    watcher.start_task(task_name)

    # = Create an empty instance file
    instance_file = os.path.join(tmp_dir, 'instances.txt')
    _write_file_with_data(instance_file, 'holdout', 'Instances', log_function)

    # = Start SMAC
    time_smac = max(0, time_for_task - watcher.wall_elapsed(basename))
    log_function('Start SMAC with %5.2fsec time left' % time_smac)
    proc_smac, smac_call = \
        submit_process.run_smac(dataset_name=basename,
                                dataset=data_manager_path,
                                tmp_dir=tmp_dir,
                                searchspace=configspace_path,
                                instance_file=instance_file,
                                limit=time_smac,
                                cutoff_time=per_run_time_limit,
                                initial_challengers=initial_configurations,
                                memory_limit=ml_memory_limit,
                                seed=get_auto_seed())
    log_function(smac_call)
    watcher.stop_task(task_name)
    return proc_smac
Exemple #2
0
def _run_ensemble_builder(tmp_dir,
                          output_dir,
                          basename,
                          time_for_task,
                          task,
                          metric,
                          ensemble_size,
                          ensemble_nbest,
                          ensemble_indices_dir,
                          watcher,
                          log_function):
    task_name = 'runEnsemble'
    watcher.start_task(task_name)
    time_left_for_ensembles = max(0, time_for_task - watcher.wall_elapsed(
        basename))
    log_function(
        'Start Ensemble with %5.2fsec time left' % time_left_for_ensembles)
    proc_ensembles = submit_process.run_ensemble_builder(
        tmp_dir=tmp_dir,
        dataset_name=basename,
        task_type=task,
        metric=metric,
        limit=time_left_for_ensembles,
        output_dir=output_dir,
        ensemble_size=ensemble_size,
        ensemble_nbest=ensemble_nbest,
        seed=get_auto_seed(),
        ensemble_indices_output_dir=ensemble_indices_dir
    )
    watcher.stop_task(task_name)
    return proc_ensembles