Rating distributionΒΆ

[1]:
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
[2]:
import sys
from pathlib import Path
root = Path(".").absolute().parent.parent
sys.path.append(str(root))
[3]:
import caption_contest_data as ccd
[4]:
def get_dist_plot(contest, alg="KLUCB"):
    df = ccd.summary(contest)

    ax = df.score.hist(bins=20, grid=False)
    ax.set_xlim(1, 3)
    ax.set_xticks([1, 2, 3])
    ax.set_xticklabels(["Unfunny", "Somewhat funny", "Funny"])
    ax.set_title(f"Ratings for contest={contest}")
    ax.set_yscale("log")
    return df, ax
[5]:
df, ax = get_dist_plot(538)
../_images/example-analyses_Rating-distribution_5_0.png
[6]:
df, ax = get_dist_plot(640)
../_images/example-analyses_Rating-distribution_6_0.png
[7]:
df, ax = get_dist_plot(586)
../_images/example-analyses_Rating-distribution_7_0.png
[8]:
df.head()
[8]:
rank funny somewhat_funny unfunny count score precision contest caption
0 1 2575 2327 1783 6685 2.118474 0.009769 586 Of course it looks alien to you. You've never ...
1 2 2164 2448 1500 6112 2.108639 0.009806 586 I have a feeling they are going to treat us li...
2 3 1771 1543 1474 4788 2.062030 0.011865 586 Left on Pennsylvania Avenue, big white house o...
3 4 1901 2088 1595 5584 2.054799 0.010564 586 And they say life can't exist in a vacuum.
4 5 1114 1221 957 3292 2.047691 0.013801 586 Wow. Aliens really do perform the jobs most Am...
[9]:
df = ccd.summary(580)
[10]:
idx = df.funny == 0
idx.sum() / len(idx)
[10]:
0.4646220719632939
[11]:
idx = df.somewhat_funny == 0
idx &= df.funny == 0
idx.sum() / len(idx)
[11]:
0.1357160106254528
[ ]: