execution_success = True #### INPUT/OUTPUT: Get input and output directory names if len(argv)==1: # Use the default input and output directories if no arguments are provided input_dir = default_input_dir output_dir = default_output_dir else: input_dir = argv[1] output_dir = os.path.abspath(argv[2]); vprint( verbose, "Using input_dir: " + input_dir) vprint( verbose, "Using output_dir: " + output_dir) # Move old results and create a new output directory if not(running_on_codalab) and save_previous_results: data_io.mvdir(output_dir, output_dir+'_'+the_date) data_io.mkdir(output_dir) #### INVENTORY DATA (and sort dataset names alphabetically) datanames = data_io.inventory_data(input_dir) # Overwrite the "natural" order #### DEBUG MODE: Show dataset list and STOP if debug_mode>=3: data_io.show_io(input_dir, output_dir) print('\n****** Sample code version ' + str(version) + ' ******\n\n' + '========== DATASETS ==========\n') data_io.write_list(datanames) datanames = [] # Do not proceed with learning and testing # ==================== @RESULT SUBMISSION (KEEP THIS) ===================== # Always keep this code to enable result submission of pre-calculated results
for key in configuration: configuration[key] = str(configuration[key]) try: configuration[key] = float(configuration[key]) if np.abs(np.round(configuration[key], 0) - configuration[key]) < 0.00001: configuration[key] = np.round(configuration[key], 0).astype(int) except Exception: pass # Move old results and create a new output directory if not(running_on_codalab) and save_previous_results: data_io.mvdir(res_dir, res_dir+'_'+the_date) data_io.mkdir(res_dir) #### INVENTORY DATA (and sort dataset names alphabetically) datanames = data_io.inventory_data(data_dir) # Overwrite the "natural" order #### DEBUG MODE: Show dataset list and STOP if debug_mode>=3: data_io.show_io(data_dir, res_dir) logger.info('****** Sample code version ' + str(version) + '******') logger.info('========== DATASETS ==========') data_io.write_list(datanames) datanames = [] # Do not proceed with learning and testing
# =========================== BEGIN PROGRAM ================================ if __name__=="__main__" and debug_mode<4: #### Check whether everything went well (no time exceeded) execution_success = True #### INPUT/OUTPUT: Get input and output directory names if len(argv)==1: # Use the default input and output directories if no arguments are provided input_dir = default_input_dir output_dir = default_output_dir else: input_dir = argv[1] output_dir = os.path.abspath(argv[2]) # Move old results and create a new output directory if not(running_on_codalab): data_io.mvdir(output_dir, '../'+output_dir+'_'+the_date) data_io.mkdir(output_dir) #### INVENTORY DATA (and sort dataset names alphabetically) datanames = data_io.inventory_data(input_dir) #### DEBUG MODE: Show dataset list and STOP if debug_mode>=3: data_io.show_io(input_dir, output_dir) print('\n****** Sample code version ' + str(version) + ' ******\n\n' + '========== DATASETS ==========\n') data_io.write_list(datanames) datanames = [] # Do not proceed with learning and testing # ==================== @RESULT SUBMISSION (KEEP THIS) ===================== # Always keep this code to enable result submission of pre-calculated results # deposited in the res/ subdirectory.
if __name__ == "__main__" and debug_mode < 4: #### Check whether everything went well (no time exceeded) execution_success = True #### INPUT/OUTPUT: Get input and output directory names if len( argv ) == 1: # Use the default input and output directories if no arguments are provided input_dir = default_input_dir output_dir = default_output_dir else: input_dir = argv[1] output_dir = os.path.abspath(argv[2]) # Move old results and create a new output directory if not (running_on_codalab): data_io.mvdir(output_dir, '../' + output_dir + '_' + the_date) data_io.mkdir(output_dir) #### INVENTORY DATA (and sort dataset names alphabetically) datanames = data_io.inventory_data(input_dir) #### DEBUG MODE: Show dataset list and STOP if debug_mode >= 3: data_io.show_io(input_dir, output_dir) print('\n****** Sample code version ' + str(version) + ' ******\n\n' + '========== DATASETS ==========\n') data_io.write_list(datanames) datanames = [] # Do not proceed with learning and testing # ==================== @RESULT SUBMISSION (KEEP THIS) ===================== # Always keep this code to enable result submission of pre-calculated results
print("Using submission_dir: " + submission_dir) # Our libraries path.append (program_dir) path.append (submission_dir) import data_io # general purpose input/output functions from data_io import vprint # print only in verbose mode from data_manager import DataManager # load/save data and get info about them from model import model # example model, in scikit-learn style if debug_mode >= 4: # Show library version and directory structure data_io.show_dir(".") # Move old results and create a new output directory (useful if you run locally) if save_previous_results: data_io.mvdir(output_dir, output_dir+'_'+the_date) data_io.mkdir(output_dir) #### INVENTORY DATA (and sort dataset names alphabetically) datanames = data_io.inventory_data(input_dir) # Overwrite the "natural" order #### DEBUG MODE: Show dataset list and STOP if debug_mode>=3: data_io.show_version() data_io.show_io(input_dir, output_dir) print('\n****** Ingestion program version ' + str(version) + ' ******\n\n' + '========== DATASETS ==========\n') data_io.write_list(datanames) datanames = [] # Do not proceed with learning and testing #### MAIN LOOP OVER DATASETS: