forked from tedunderwood/HathiGenreTrainingset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccuracyPlotter.py
31 lines (21 loc) · 857 Bytes
/
AccuracyPlotter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# plotter
import matplotlib.pyplot as plt
import SonicScrewdriver as utils
import pandas as pd
from scipy.stats.stats import pearsonr
indices, columns, agreement = utils.readtsv("/Users/tunder/Dropbox/pagedata/interrater/HumanDissensus.tsv")
indices2, columns2, confidence = utils.readtsv("/Users/tunder/Dropbox/pagedata/interrater/ActualAccuracies.tsv")
for idx in indices:
if idx not in indices2:
print(idx + " is missing.")
makeframe = dict()
makeframe["human-agreement"] = agreement["agreement"]
makeframe["machine-accuracy"] = confidence["accuracy"]
df = pd.DataFrame(makeframe, dtype="float")
df = df.dropna()
print(str(pearsonr(df["human-agreement"], df["machine-accuracy"])))
plt.plot(df["human-agreement"], df["machine-accuracy"], "r.")
plt.xlabel("Human agreement")
plt.ylabel("Machine accuracy")
plt.axis([0,1.02,0,1.02])
plt.show()