Example #1
0
                  c='k',
                  fname='{}/assemblies{}'.format(results_dir, i / 2))

    n_runs = 10

    feasibility_func = import_module('{}.feasibility'.format(
        args.data)).check_feasibility
    prc_mean, prc_err = ci_prc(n_runs, model.synthesize_assemblies,
                               feasibility_func, n_points)
    print('Precision for assembly: %.3f +/- %.3f' % (prc_mean, prc_err))
    mmd_mean, mmd_err = ci_mmd(n_runs, model.synthesize_assemblies, X_test)
    rdiv_mean, rdiv_err = ci_rdiv(n_runs, X_test, model.synthesize_assemblies)
    basis = 'cartesian'
    cons_mean, cons_err = ci_cons(n_runs,
                                  model.synthesize_assemblies,
                                  latent_dim,
                                  bounds,
                                  basis=basis)

    res = {
        'CSS': [prc_mean, prc_err],
        'MMD': [mmd_mean, mmd_err],
        'R-Div': [rdiv_mean, rdiv_err],
        'LSC': [cons_mean, cons_err]
    }
    json.dump(res, open('{}/results.json'.format(results_dir), 'w'))

    results_mesg_0 = 'Precision for assembly: %.3f +/- %.3f' % (prc_mean,
                                                                prc_err)
    results_mesg_1 = 'Maximum mean discrepancy for assembly: %.4f +/- %.4f' % (
        mmd_mean, mmd_err)
Example #2
0
    n_runs = 10

    feasibility_func = import_module('{}.feasibility'.format(
        args.data)).check_feasibility
    prc_mean, prc_err = ci_prc(n_runs, model.synthesize_assemblies,
                               feasibility_func, n_points)
    print('Precision for assembly: %.3f +/- %.3f' % (prc_mean, prc_err))
    mmd_mean, mmd_err = ci_mmd(n_runs, model.synthesize_assemblies, X_test)
    rdiv_mean, rdiv_err = ci_rdiv(n_runs, X_test, model.synthesize_assemblies)
    if args.data == 'SC':
        basis = 'polar'
    else:
        basis = 'cartesian'
    cons0_mean, cons0_err = ci_cons(n_runs,
                                    model.synthesize_x0,
                                    latent_dim[0],
                                    bounds,
                                    basis='cartesian')
    cons1_mean, cons1_err = ci_cons(n_runs,
                                    model.synthesize_x1,
                                    latent_dim[1],
                                    bounds,
                                    basis=basis)

    res = {
        'CSS': [prc_mean, prc_err],
        'MMD': [mmd_mean, mmd_err],
        'R-Div': [rdiv_mean, rdiv_err],
        'LSC_A': [cons0_mean, cons0_err],
        'LSC_B': [cons1_mean, cons1_err]
    }
Example #3
0
 for i in range(len(n_points)):
     assemblies_list.append(assemblies[:25, n_points_c[i]:n_points_c[i+1]])
 plot_samples(None, assemblies_list, scatter=False, alpha=.7, c='k', fname='{}/assemblies'.format(results_dir))
 
 n_runs = 10
 
 feasibility_func = import_module('{}.feasibility'.format(args.data)).check_feasibility
 prc_mean, prc_err = ci_prc(n_runs, model.synthesize_assemblies, feasibility_func, n_points)
 print('Precision for assembly: %.3f +/- %.3f' % (prc_mean, prc_err))
 mmd_mean, mmd_err = ci_mmd(n_runs, model.synthesize_assemblies, X_test)
 rdiv_mean, rdiv_err = ci_rdiv(n_runs, X_test, model.synthesize_assemblies)
 if args.data == 'SCCC':
     basis = 'polar'
 else:
     basis = 'cartesian'
 cons0_mean, cons0_err = ci_cons(n_runs, model.synthesize_x0, latent_dim[0], bounds, basis='cartesian')
 cons1_mean, cons1_err = ci_cons(n_runs, model.synthesize_x1, latent_dim[1], bounds, basis=basis)
 cons2_mean, cons2_err = ci_cons(n_runs, model.synthesize_x2, latent_dim[2], bounds, basis=basis)
 cons3_mean, cons3_err = ci_cons(n_runs, model.synthesize_x3, latent_dim[3], bounds, basis=basis)
 cons4_mean, cons4_err = ci_cons(n_runs, model.synthesize_x4, latent_dim[4], bounds, basis=basis)
 
 res = {'CSS': [prc_mean, prc_err], 
        'MMD': [mmd_mean, mmd_err], 
        'R-Div': [rdiv_mean, rdiv_err], 
        'LSC_A': [cons0_mean, cons0_err], 
        'LSC_B': [cons1_mean, cons1_err], 
        'LSC_C': [cons2_mean, cons2_err], 
        'LSC_D': [cons3_mean, cons3_err], 
        'LSC_E': [cons4_mean, cons4_err]}
 json.dump(res, open('{}/results.json'.format(results_dir), 'w'))