Ejemplo n.º 1
0
                              discretizer,
                              normalizer,
                              args.batch_size,
                              args.small_part,
                              target_repl,
                              shuffle=False)

if args.mode == 'train':
    # Prepare training
    path = os.path.join(
        args.output_dir, 'keras_states/' + model.final_name +
        '.epoch{epoch}.test{val_loss}.state')

    metrics_callback = keras_utils.PhenotypingMetrics(
        train_data_gen=train_data_gen,
        val_data_gen=val_data_gen,
        batch_size=args.batch_size,
        verbose=args.verbose)
    # make sure save directory exists
    dirname = os.path.dirname(path)
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    saver = ModelCheckpoint(path, verbose=1, period=args.save_every)

    keras_logs = os.path.join(args.output_dir, 'keras_logs')
    if not os.path.exists(keras_logs):
        os.makedirs(keras_logs)
    csv_logger = CSVLogger(os.path.join(keras_logs, model.final_name + '.csv'),
                           append=True,
                           separator=';')
Ejemplo n.º 2
0
                              normalizer,
                              args.batch_size,
                              args.small_part,
                              target_repl,
                              shuffle=False)

if args.mode == 'train':
    # Prepare training
    path = os.path.join(
        args.output_dir, 'keras_states/' + model.final_name +
        '.epoch{epoch}.test{val_loss}.state')

    metrics_callback = keras_utils.PhenotypingMetrics(
        train_data_gen=train_data_gen,
        val_data_gen=val_data_gen,
        delta=1e-7,
        batch_size=args.batch_size,
        verbose=args.verbose,
        dp=args.dp,
        noise_multiplier=args.noise_multiplier)
    # make sure save directory exists
    dirname = os.path.dirname(path)
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    saver = ModelCheckpoint(path, verbose=1, period=args.save_every)

    keras_logs = os.path.join(args.output_dir, 'keras_logs')
    if not os.path.exists(keras_logs):
        os.makedirs(keras_logs)
    csv_logger = CSVLogger(os.path.join(keras_logs, model.final_name + '.csv'),
                           append=True,
                           separator=';')