Exemplo n.º 1
0
def load_rbns_from_erb(directory, remember):
    rbn_distribution, name = glob_load(directory + '*distribution')[0]

    scatterplot = ["x y"]

    for accuracy, rbn in rbn_distribution:
        cc = measure_computational_capability(rbn, 100, remember)
        scatterplot.append("{} {}".format(cc, accuracy))

    distribution = {}
    distplot = ["\\myboxplot{"]
    for accuracy, rbn in rbn_distribution:
        ic = rbn.input_connectivity
        if ic not in distribution:
            distribution[ic] = []

        distribution[ic].append(accuracy)

    for i, l in enumerate(sorted(distribution.keys())):
        distplot.append("% L: {}".format(i))
        distplot.append("\\addplot[boxplot]")
        distplot.append("table[row sep=\\\\, y index=0] {")
        distplot.append("data")
        for fitness in distribution[l]:
            distplot.append("{} \\\\".format(fitness))

        distplot.append("};")

    distplot.append("}}{{{}}}".format(10.0 / max(distribution.keys())))

    return '\n'.join(scatterplot), '\n'.join(distplot)
Exemplo n.º 2
0
def load_rbns_from_erb(directory, remember):
    rbn_distribution, name = glob_load(directory + '*distribution')[0]

    scatterplot = ["x y"]

    for accuracy, rbn in rbn_distribution:
        cc = measure_computational_capability(rbn, 100, remember)
        scatterplot.append("{} {}".format(cc, accuracy))

    distribution = {}
    distplot = ["\\myboxplot{"]
    for accuracy, rbn in rbn_distribution:
        ic = rbn.input_connectivity
        if ic not in distribution:
            distribution[ic] = []

        distribution[ic].append(accuracy)

    for i, l in enumerate(sorted(distribution.keys())):
        distplot.append("% L: {}".format(i))
        distplot.append("\\addplot[boxplot]")
        distplot.append("table[row sep=\\\\, y index=0] {")
        distplot.append("data")
        for fitness in distribution[l]:
            distplot.append("{} \\\\".format(fitness))

        distplot.append("};")

    distplot.append("}}{{{}}}".format(10.0 / max(distribution.keys())))

    return '\n'.join(scatterplot), '\n'.join(distplot)
Exemplo n.º 3
0
#}},
#] coordinates {{}};""".format(l, i, median, upperq, lowerq, upperw, lowerw)
#
#        print boxplot
#
#    print "}}{{{}}}".format(10.0 / max(distribution.keys()))


if __name__ == '__main__':
    #filename = "pickle_dumps/distribution-100-5-3/combined-distribution"
    #computational_power_scatter()
    #distribution_to_plot()
    #erb()

    rbn, _ = glob_load('pickle_dumps/70input-2/*-reservoir')[0]
    ccs = [measure_computational_capability(rbn, 100, 3) for _ in range(20)]
    print ccs, np.median(ccs), np.mean(ccs)

    #postfix = default_input('Postfix?', '-3-1')
    #remember = int(postfix.split("-")[1]) - 1

    #scatter, box = load_rbns_from_erb('pickle_dumps/c-distribution-100' + postfix + '/', remember)

    #print scatter

    #sc = open('pickle_dumps/c-distribution-100' + postfix +
    #          '/computational-power-100' + postfix + '.dat', 'w')
    #sc.write(scatter)
    #sc.close()

    #bx = open('pickle_dumps/c-distribution-100' + postfix +
Exemplo n.º 4
0
#    lower whisker={}
#}},
#] coordinates {{}};""".format(l, i, median, upperq, lowerq, upperw, lowerw)
#
#        print boxplot
#
#    print "}}{{{}}}".format(10.0 / max(distribution.keys()))

if __name__ == '__main__':
    #filename = "pickle_dumps/distribution-100-5-3/combined-distribution"
    #computational_power_scatter()
    #distribution_to_plot()
    #erb()

    rbn, _ = glob_load('pickle_dumps/70input-2/*-reservoir')[0]
    ccs = [measure_computational_capability(rbn, 100, 3) for _ in range(20)]
    print ccs, np.median(ccs), np.mean(ccs)

    #postfix = default_input('Postfix?', '-3-1')
    #remember = int(postfix.split("-")[1]) - 1

    #scatter, box = load_rbns_from_erb('pickle_dumps/c-distribution-100' + postfix + '/', remember)

    #print scatter

    #sc = open('pickle_dumps/c-distribution-100' + postfix +
    #          '/computational-power-100' + postfix + '.dat', 'w')
    #sc.write(scatter)
    #sc.close()

    #bx = open('pickle_dumps/c-distribution-100' + postfix +