//  [python]
def visualize():
    def load(lib):
        batch = np.loadtxt("results-batch-size-%s.csv" % lib, delimiter=",")
        nfeat = np.loadtxt("results-nfeat-%s.csv" % lib, delimiter=",")
        return batch, nfeat



    fig, axes = plt.subplots(nrows=2, ncols=2)
    sns.utils.despine()
    # sns.set_context("poster")
    fig.set_figheight(6)
    fig.set_figwidth(9)

    names = [f[f.index('size-') + 5:-4] for f in glob('*size*.csv')]

    for name in names:
        batch_res, nfeat_res = load(name)
        axes[0, 0].plot(batch_res[:, 0], batch_res[:, 1], label=name)
        axes[0, 1].plot(nfeat_res[:, 0], nfeat_res[:, 1], label=name)
    # pytorch_batch, pytorch_nfeat = load("pytorch")
    # spflow_batch, spflow_nfeat = load("spflow")
    # tf_batch, tf_nfeat = load("spflow-tf")
    # spflow_layers_batch, spflow_layers_nfeat = load("spflow-layer")

    # Plot absolute values
    #axes[0, 0].plot(spflow_batch[:, 0], spflow_batch[:, 1], label="SPFlow")
    #axes[0, 0].plot(tf_batch[:, 0], tf_batch[:, 1], label="SPFlow-TF")
    #axes[0, 0].plot(pytorch_batch[:, 0], pytorch_batch[:, 1], label="Layerwise PyTorch")
    #axes[0, 0].plot(spflow_layers_batch[:, 0], spflow_layers_batch[:, 1], label="SPFlow Layers")

    #axes[0, 1].plot(spflow_nfeat[:, 0], spflow_nfeat[:, 1], label="SPFlow")
    #axes[0, 1].plot(tf_nfeat[:, 0], tf_nfeat[:, 1], label="SPFlow-TF")
    #axes[0, 1].plot(pytorch_nfeat[:, 0], pytorch_nfeat[:, 1], label="Layerwise PyTorch")
    #axes[0, 1].plot(spflow_layers_nfeat[:, 0], spflow_layers_nfeat[:, 1], label="SPFlow Layers")

    fontP = FontProperties()
    fontP.set_size("small")
    axes[0, 1].legend(loc="upper left", fancybox=True, framealpha=0.5, prop=fontP)

    axes[0, 0].set_xscale("log", basex=2)
    axes[0, 0].set_yscale("log", basey=10)
    axes[0, 1].set_xscale("log", basex=2)
    axes[0, 1].set_yscale("log", basey=10)

    # Plot relative improvements
    # axes[1, 0].plot(
    #     spflow_batch[:, 0],
    #     spflow_batch[:, 1] / pytorch_batch[:, 1],
    #     label="SPFlow/Layerwise PyTorch",
    # )
    # axes[1, 0].plot(
    #     tf_batch[:, 0],
    #     tf_batch[:, 1] / pytorch_batch[:, 1],
    #     label="SPFlow-TF/Layerwise PyTorch",
    # )
    # axes[1, 1].plot(
    #     spflow_nfeat[:, 0],
    #     spflow_nfeat[:, 1] / pytorch_nfeat[:, 1],
    #     label="SPFlow/Layerwise PyTorch",
    # )
    # axes[1, 1].plot(
    #     tf_nfeat[:, 0],
    #     tf_nfeat[:, 1] / pytorch_nfeat[:, 1],
    #     label="SPFlow-TF/Layerwise PyTorch",
    # )

    axes[1, 0].set_xscale("log", basex=2)
    # axes[1, 0].set_yscale("log", basey=10)
    axes[1, 1].set_xscale("log", basex=2)
    # axes[1, 1].set_yscale("log", basey=10)
    axes[0, 0].set_ylabel("Avg Time (s) over 100 Runs")
    axes[0, 1].set_ylabel("Avg Time (s) over 100 Runs")
    axes[1, 0].set_ylabel(r"Relative Time $\frac{t_x}{t_{PyTorch}}$")
    axes[1, 1].set_ylabel(r"Relative Time $\frac{t_x}{t_{PyTorch}}$")
    axes[0, 0].set_xlabel("Batch Size")
    axes[0, 1].set_xlabel("Features")
    axes[1, 0].set_xlabel("Batch Size")
    axes[1, 1].set_xlabel("Features")
    axes[1, 1].legend(loc="upper left", fancybox=True, framealpha=0.5, prop=fontP)

    # Titles
    title = "vs".join(names) + " SPN Forward" #"SPFlow vs SPFlow-TF vs PyTorch: SPN Forward Pass"
    fig.suptitle(title)
    plt.savefig("benchmark.png", dpi=300)