learner_name = job_description["learner"] fit_params = copy.deepcopy(job_description["fit_params"]) learner_params = job_description["learner_params"] hp_iters = int(job_description["hp_iters"]) hp_ranges = copy.deepcopy(job_description["hp_ranges"]) hp_fit_params = copy.deepcopy(job_description["hp_fit_params"]) learning_problem = job_description["learning_problem"] experiment_schema = job_description["experiment_schema"] experiment_table = job_description["experiment_table"] validation_loss = job_description["validation_loss"] hash_value = job_description["hash_value"] random_state = np.random.RandomState(seed=seed + fold_id) optimizer_path = os.path.join(DIR_PATH, OPTIMIZER_FOLDER, "{}".format(hash_value)) hash_file = os.path.join(DIR_PATH, MODEL_FOLDER, "{}.h5".format(hash_value)) configure_numpy_keras(seed=seed) dataset_params['random_state'] = random_state dataset_params['fold_id'] = fold_id dataset_reader = get_dataset_reader(dataset_name, dataset_params) inner_cv = ShuffleSplit(n_splits=n_inner_folds, test_size=0.1, random_state=random_state) if learner_name in [MNL, PCL, NLM, GEV, MLM]: fit_params['random_seed'] = seed + fold_id fit_params['vi_params']["callbacks"] = [pm.callbacks.CheckParametersConvergence(diff="absolute", tolerance=0.01 , every=50)] optimizer = load(optimizer_path) if "ps" in optimizer.acq_func: best_i = np.argmin(np.array(optimizer.yi)[:, 0]) else: best_i = np.argmin(optimizer.yi) best_point = optimizer.Xi[best_i] best_loss = optimizer.yi[best_i]
import inspect import logging import os from csrank import TagGenomeObjectRankingDatasetReader from csrank.tensorflow_util import configure_numpy_keras from csrank.util import setup_logging if __name__ == '__main__': DIR_PATH = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) log_path = os.path.join(DIR_PATH, 'logs', 'prepare_tag_genome.log') setup_logging(log_path=log_path) configure_numpy_keras(seed=42) logger = logging.getLogger('TagGenome') logger.info("ccs req id : {}".format(os.environ['CCS_REQID'])) tg = TagGenomeObjectRankingDatasetReader()