Beispiel #1
0
def plotVsMaxInDegree(data, prop, label):
    pl.newFigure()
    pl.plot(getLevel0Prop(data, "max in-degree"),
            getLevel0Prop(data, prop),
            style='k-o',
            markerSize=4)
    pl.labels("In-degree threshold", label)
Beispiel #2
0
def plotLevel0VsLevel1Stats(data, prop0, prop1, label0, label1):
    d0 = getLevel0Prop(data, prop0)
    m, std, sm = level1Stats(data, prop1)
    for (v, p) in [(m, "mean"), (std, "standard deviation"), (sm, "sum")]:
        pl.newFigure()
        pl.plot(d0, v, style='ko-', xLog=False, yLog=False)
        pl.labels(label0, label1 + " " + p)
Beispiel #3
0
def wordSimScatterPlot(set1, set2, label1, label2):
    pl.newFigure()
    sims1, sims2 = intersectionSimilarities(set1, set2)
    pl.plot(sims1, sims2, style='ko', markerSize=4)
    pl.labels(label1, label2)
    print "Spearman correlation between", label1, "and", label2, ":", spearmanCorrelation(
        sims1, sims2)
Beispiel #4
0
def similarityDistribution(data):
    pl.newFigure()
    for d in data["results"]:
        hist = d["relative l1 norm"]["histogram"]
        bins = [1.0 - b for [b, c] in hist]
        counts = [float(c) for [t, c] in hist]
        tot = sum(counts)
        pl.plot(bins, [c / tot for c in counts],
                style='-',
                xLog=True,
                yLog=True)
    pl.labels("$1 - \mathrm{L_{1}}$", "Density")
    pl.legend(getLevel0Prop(data, "max in-degree"))
Beispiel #5
0
def histograms(data, prop, label):
    pl.newFigure()
    for d in data["results"]:
        hist = d[prop]["histogram"]
        bins = [b for [b, c] in hist]
        counts = [float(c) for [b, c] in hist]
        deltaTot = sum(counts) * (bins[1] - bins[0])
        pl.plot(bins, [c / deltaTot for c in counts],
                style='-',
                xLog=False,
                yLog=False)
    pl.labels(label, "Density")
    pl.legend(getLevel0Prop(data, "max in-degree"))
Beispiel #6
0
def correlationsVsLevel0Prop(data, prop0, label0, benchmarks, benchLabels):
    pl.newFigure()
    l0Prop = getLevel0Prop(data, prop0)
    l1Sims = selectedSimilarities(data)

    for b in benchmarks:

        def spearman(s1, s2):
            sims1, sims2 = intersectionSimilarities(s1, s2)
            return spearmanCorrelation(sims1, sims2)

        correlations = [spearman(b, s1) for s1 in l1Sims]
        pl.plot(l0Prop, correlations, style='o-', markerSize=4)

    pl.labels(label0, "Spearman rank correlation coefficient")
    pl.legend(benchLabels)
Beispiel #7
0
def plotVsMaxInDegree(data, prop, label):
    pl.newFigure()
    pl.plot(getLevel0Prop(data, "max in-degree"),
            getLevel0Prop(data, prop),
            style='k-o',
            markerSize=4)
    pl.labels("In-degree threshold", label)


def level0Plot(data, (prop1, label1), (prop2, label2)):
    fig = pl.newFigure()
    pl.plot(getLevel0Prop(data, prop1),
            getLevel0Prop(data, prop2),
            style='k-o',
            markerSize=4)
    pl.labels(label1, label2)
    return fig


def histograms(data, prop, label):
    pl.newFigure()
    for d in data["results"]:
        hist = d[prop]["histogram"]
        bins = [b for [b, c] in hist]
        counts = [float(c) for [b, c] in hist]
        deltaTot = sum(counts) * (bins[1] - bins[0])
        pl.plot(bins, [c / deltaTot for c in counts],
                style='-',
                xLog=False,
                yLog=False)
    pl.labels(label, "Density")