(args, defaults, description)
Execute a complete training run.
Execute a complete training run.
Execute a complete training run .
def launch(args, defaults, description):
    """
    Execute a complete training run.
    """

    rec_screen = ""
    if "--nn-file" in args:
      temp_params = vars(load_params(args[args.index("--nn-file")+1]))
      for p in temp_params:
        try:
          vars(defaults)[p.upper()] = temp_params[p]
        except:
          print "warning: parameter", p, "from param file doesn't exist."
      #rec_screen = args[args.index("--nn-file")+1][:-len("last_model.pkl")]+"/frames"

    parameters = process_args(args, defaults, description)

    if parameters.rom.endswith('.bin'):
        rom = parameters.rom
    else:
        rom = "%s.bin" % parameters.rom
    parameters.rom_path = os.path.join(defaults.BASE_ROM_PATH, rom)

    rng = np.random.RandomState(123456)

    folder_name = None if parameters.folder_name == "" else parameters.folder_name

    ale = ALEInterface()
    ale.setInt('random_seed', rng.randint(1000))
    ale.setBool('display_screen', parameters.display_screen)
    ale.setString('record_screen_dir', rec_screen)
    trainer = Q_Learning(model_params=parameters, ale_env=ale, folder_name=folder_name)
    trainer.train()
def launch ( args , defaults , description ) : rec_screen = "" if "--nn-file" in args : temp_params = vars ( load_params ( args [ args . index ( "--nn-file" ) + 1 ] ) ) for p in temp_params : try : vars ( defaults ) [ p . upper ( ) ] = temp_params [ p ] except : print "warning: parameter" , p , "from param file doesn't exist." #rec_screen = args[args.index("--nn-file")+1][:-len("last_model.pkl")]+"/frames" parameters = process_args ( args , defaults , description ) if parameters . rom . endswith ( '.bin' ) : rom = parameters . rom else : rom = "%s.bin" % parameters . rom parameters . rom_path = os . path . join ( defaults . BASE_ROM_PATH , rom ) rng = np . random . RandomState ( 123456 ) folder_name = None if parameters . folder_name == "" else parameters . folder_name ale = ALEInterface ( ) ale . setInt ( 'random_seed' , rng . randint ( 1000 ) ) ale . setBool ( 'display_screen' , parameters . display_screen ) ale . setString ( 'record_screen_dir' , rec_screen ) trainer = Q_Learning ( model_params = parameters , ale_env = ale , folder_name = folder_name ) trainer . train ( )