コード例 #1
0
def exp011():
    """
    The relationship might be better represented with word count on a log
    scale. This plot shows that the two values are strongly correlated.
    """
    x, y = zip(*getWordCountAffectCount(True))
    plt.ylabel("affect ratio")
    plt.xlabel("comment length (log number of words)")
    _, pearP = pearsonr(x, y)
    plt.scatter(x, y, lw=0)
    plt.legend(loc=3)
    plt.savefig("../experiments/exp011.pdf", format="pdf")
コード例 #2
0
def exp01():
    """
    Experiment 1:
    Make scatter plot about comment length vs. affect ratio. This plot shows
    that increasing comment length does result in a lower affect ratio.
    However, if the change in affect ratio was caused by a change in comment
    length, then we should be able to predict comment length.
    """
    x, y = zip(*getWordCountAffectCount())
    plt.scatter(x, y)
    plt.ylabel("affect ratio")
    plt.xlabel("comment length (# words)")
    _, pearP = pearsonr(x, y)
    label = "p < 0.0001" if pearP < 0.0001 else "p = %0.4f" % pearP
    plt.scatter(x, y, label=label)
    plt.legend(loc=3)
    plt.savefig("../experiments/exp01.pdf", format="pdf")