def run(self): """Run a gridsearch trial. """ # Update logging if module is invoked from the command line if __name__ == "__main__": # Create stdout log handler self._logger.addHandler(crf_util.get_StreamHandler(self.verbosity)) self._logger.debug("Logging stream handler to sys.stdout added.") super().run()
def run(self): """Run a gridsearch trial. """ if __name__ == "__main__": # Create stdout log handler if module is invoked from the command line self._logger.addHandler(crf_util.get_StreamHandler(self.verbosity)) self._logger.debug("Logging stream handler to sys.stdout added.") self.setup_exec_train_model() # Wait for train CRF to be done and run merge and save_best crf_util.wait_and_run(self.test_train_CRFs, self.merge_save_train_models) best_params_path = os.path.join(self._expt_dir, self._experiment, "results", "best_parameters.txt") self._logger.info("Grid search complete. Best parameters in {}".format( best_params_path) + " in the following order:\n{}\n".format( self.__class__._PARAMS_TO_EXTRACT))
def run(self): """Run a shuffled controls trial. """ if __name__ == "__main__": # Create stdout log handler if module is invoked from the command line self._logger.addHandler(crf_util.get_StreamHandler(self.verbosity)) self._logger.debug("Logging stream handler to sys.stdout added.") # Create bare-bones shuffle folder and create shuffled datasets self.setup_shuffle_model() # Get best params best_params = GridsearchTrial.get_best_parameters( os.path.join(self._expt_dir, self._experiment, "results")) self._logger.info("Parameters for {} collected.\n".format( self.condition_name)) # create shuffle configs with best params (write and run write_configs_for_loopy.m) self.create_shuffle_configs(best_params) # Wait for all shuffled datasets to be created and run shuffle/start_jobs.sh crf_util.wait_and_run(self.simple_test_shuffle_datasets, self.train_controls) # Wait for shuffle CRFs to be done and run merge and save_shuffle crf_util.wait_and_run(self.test_shuffle_CRFs, self.exec_merge_shuffle_CRFs)
shuffles.exec_merge_shuffle_CRFs) # Extract ensemble neuron IDs. Write to disk? if __name__ == "__main__": start_time = time.time() try: condition = sys.argv[1] except IndexError: raise TypeError("A condition name must be passed on the command line.") logger = logging.getLogger("top") logger.setLevel(logging.DEBUG) init_log_handler = logging.StreamHandler(stream=sys.stdout) init_log_handler.setLevel(logging.INFO) logger.addHandler(init_log_handler) if len(sys.argv) > 2: ini_fname = sys.argv[2] logger.info("Using custom settings filename: {}".format(ini_fname)) shuffles = ShuffledControlsTrial(condition, ini_fname=ini_fname) gridsearch = GridsearchTrial(condition, ini_fname=ini_fname) else: shuffles = ShuffledControlsTrial(condition) gridsearch = GridsearchTrial(condition) logger.addHandler(crf_util.get_StreamHandler(gridsearch.verbosity)) logger.removeHandler(init_log_handler) main(gridsearch, shuffles, logger) print("Total run time: {0:.2f} seconds".format(time.time() - start_time))