<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from efficiency.log import show_var

file = "nodes_vs_variations.txt"
import csv

with open(file) as f:
    reader = csv.DictReader(f, delimiter=" ")
    content = list(reader)
    node_num_n_var = [(int(i["#nodes"]), int(i["#diffs"])) for i in content]

from collections import Counter

counter = Counter(node_num_n_var)
print(counter.most_common())
counter = dict(sorted(counter.items()))
x, y = zip(*counter.keys())
cnt = counter.values()
radius = np.array(list(cnt)) / 2
area = radius ** 2 * np.pi
# Fixing random state for reproducibility
np.random.seed(19680801)

colors = np.random.rand(len(counter))

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.xlabel("# Triples of the Input Graph in WebNLG 2017")
plt.ylabel("# Variations of Generated Text")
plt.title("Text Diversity Generated by CycleCVAE")

x2argmax_y = {}
for (x, y), cnt in counter.items():
    if cnt < 10:
        continue
    if x in x2argmax_y:
        prev_y, prev_cnt = x2argmax_y[x]
        if cnt < prev_cnt:
            continue
    x2argmax_y[x] = (y, cnt)
x = list(x2argmax_y.keys())
y, cnt = zip(*x2argmax_y.values())
show_var(["x", "y"])
import pdb

pdb.set_trace()
plt.plot(x, y)


plt.show()

import numpy as np
import matplotlib.pyplot as plt
from efficiency.log import show_var

file = "nodes_vs_variations.txt"
import csv

with open(file) as f:
    reader = csv.DictReader(f, delimiter=" ")
    content = list(reader)
    node_num_n_var = [(int(i["#nodes"]), int(i["#diffs"])) for i in content]

from collections import Counter

counter = Counter(node_num_n_var)
print(counter.most_common())
counter = dict(sorted(counter.items()))
x, y = zip(*counter.keys())
cnt = counter.values()
radius = np.array(list(cnt)) / 2
area = radius ** 2 * np.pi
# Fixing random state for reproducibility
np.random.seed(19680801)

colors = np.random.rand(len(counter))

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.xlabel("# Triples of the Input Graph in WebNLG 2017")
plt.ylabel("# Variations of Generated Text")
plt.title("Text Diversity Generated by CycleCVAE")

x2argmax_y = {}
for (x, y), cnt in counter.items():
    if cnt < 10:
        continue
    if x in x2argmax_y:
        prev_y, prev_cnt = x2argmax_y[x]
        if cnt < prev_cnt:
            continue
    x2argmax_y[x] = (y, cnt)
x = list(x2argmax_y.keys())
y, cnt = zip(*x2argmax_y.values())
show_var(["x", "y"])
import pdb

pdb.set_trace()
plt.plot(x, y)


plt.show()
# Fixing random state for reproducibility