How to use the ctgan.data.write_tsv function in ctgan

To help you get started, we’ve selected a few ctgan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DAI-Lab / CTGAN / ctgan / __main__.py View on Github external
args.data, args.metadata, args.header, args.discrete)

    gen_dims = [int(x) for x in args.gen_dims.split(',')]
    dis_dims = [int(x) for x in args.dis_dims.split(',')]
    model = CTGANSynthesizer(
        z_dim=args.z_dim, gen_dims=gen_dims, dis_dims=dis_dims,
        gen_lr=args.gen_lr, gen_decay=args.gen_decay,
        dis_lr=args.dis_lr, dis_decay=args.dis_decay,
        batch_size=args.bs)
    model.fit(data, discrete_columns, args.epochs)

    num_samples = args.num_samples or len(data)
    sampled = model.sample(num_samples)

    if args.tsv:
        write_tsv(sampled, args.metadata, args.output)
    else:
        sampled.to_csv(args.output, index=False)