def get_baseline_rd(test_data_id, N, samp, cap, logfilename=os.devnull):
    '\n    Compute and save relative distances between pairs of points found by the baseline solver.\n    Relative distance is defined in (Katz and Reggia 2017).\n    Computes for the samp^{th} sample network of size N in test_data_id.\n    test_data_id should be as in fxpt_experiments.generate_test_data (without file extension).\n    Only pairs within a random subset of points of size cap are inspected.\n    logfilename is a file name at which progress updates are written.\n    '
    logfile = open(logfilename, 'w')
    logfile.write(('Running baseline rd (%s,%d,%d)...\n' % (test_data_id, N, samp)))
    npz = fe.load_npz_file(('results/baseline_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)))
    fxV = npz['fxV_converged']
    fxV_unique = npz['fxV_unique']
    W = npz['W']
    if ((cap is not None) and (fxV.shape[1] > cap)):
        logfile.write('capping...\n')
        perm = np.random.permutation(fxV.shape[1])
        fxV = fxV[:, perm[:cap]]
    (in_RR, out_RR) = ([], [])
    for j in range(fxV_unique.shape[1]):
        logfile.write(('duping %d of %d...\n' % (j, fxV_unique.shape[1])))
        (dups, RR, R) = rfx.identical_fixed_points(W, fxV, fxV_unique[:, [j]])
        in_RR.append(RR[dups])
        out_RR.append(RR[(~ dups)])
    (in_RR, out_RR) = (np.concatenate(in_RR), np.concatenate(out_RR))
    (npz['in_RR'], npz['out_RR']) = (in_RR, out_RR)
    fe.save_npz_file(('results/baseline_rd_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)), **npz)
    logfile.write('Done.\n')
    logfile.close()
    print(('Done %s %d %d' % (test_data_id, N, samp)))
Compute and save relative distances between pairs of points found by the baseline solver.
Relative distance is defined in (Katz and Reggia 2017).
Computes for the samp^{th} sample network of size N in test_data_id.
test_data_id should be as in fxpt_experiments.generate_test_data (without file extension).
Only pairs within a random subset of points of size cap are inspected.
logfilename is a file name at which progress updates are written.
def get_baseline_rd(test_data_id, N, samp, cap, logfilename=os.devnull):
    '\n    Compute and save relative distances between pairs of points found by the baseline solver.\n    Relative distance is defined in (Katz and Reggia 2017).\n    Computes for the samp^{th} sample network of size N in test_data_id.\n    test_data_id should be as in fxpt_experiments.generate_test_data (without file extension).\n    Only pairs within a random subset of points of size cap are inspected.\n    logfilename is a file name at which progress updates are written.\n    '
    logfile = open(logfilename, 'w')
    logfile.write(('Running baseline rd (%s,%d,%d)...\n' % (test_data_id, N, samp)))
    npz = fe.load_npz_file(('results/baseline_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)))
    fxV = npz['fxV_converged']
    fxV_unique = npz['fxV_unique']
    W = npz['W']
    if ((cap is not None) and (fxV.shape[1] > cap)):
        logfile.write('capping...\n')
        perm = np.random.permutation(fxV.shape[1])
        fxV = fxV[:, perm[:cap]]
    (in_RR, out_RR) = ([], [])
    for j in range(fxV_unique.shape[1]):
        logfile.write(('duping %d of %d...\n' % (j, fxV_unique.shape[1])))
        (dups, RR, R) = rfx.identical_fixed_points(W, fxV, fxV_unique[:, [j]])
        in_RR.append(RR[dups])
        out_RR.append(RR[(~ dups)])
    (in_RR, out_RR) = (np.concatenate(in_RR), np.concatenate(out_RR))
    (npz['in_RR'], npz['out_RR']) = (in_RR, out_RR)
    fe.save_npz_file(('results/baseline_rd_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)), **npz)
    logfile.write('Done.\n')
    logfile.close()
    print(('Done %s %d %d' % (test_data_id, N, samp)))