|
|
@ -7,48 +7,50 @@ from pyecharts.globals import ThemeType
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
outcome_dir = r'E:\Data\Research\Outcome'
|
|
|
|
outcome_dir = r'E:\Data\Research\Outcome'
|
|
|
|
configs_dir = r'\Magellan+Smac+roberta-large-nli-stsb-mean-tokens+inter-0.5'
|
|
|
|
inter_list = ['0', '0.5', '0.7', '0.9', '1']
|
|
|
|
|
|
|
|
configs_dir = r'\Magellan+Smac+roberta-large-nli-stsb-mean-tokens+inter-'
|
|
|
|
datasets_list = os.listdir(outcome_dir)
|
|
|
|
datasets_list = os.listdir(outcome_dir)
|
|
|
|
|
|
|
|
|
|
|
|
for _ in datasets_list:
|
|
|
|
for _ in datasets_list:
|
|
|
|
path = outcome_dir + rf'\{_}' + configs_dir
|
|
|
|
for inter in inter_list:
|
|
|
|
statistics_files = os.listdir(path)
|
|
|
|
path = outcome_dir + rf'\{_}' + configs_dir + inter
|
|
|
|
length = 0
|
|
|
|
statistics_files = os.listdir(path)
|
|
|
|
for file in statistics_files:
|
|
|
|
length = 0
|
|
|
|
if file.startswith('predictions'):
|
|
|
|
for file in statistics_files:
|
|
|
|
preds = pd.read_csv(path + rf'\{file}', encoding='ISO-8859-1')
|
|
|
|
if file.startswith('predictions'):
|
|
|
|
preds = preds[['predicted', 'confidence']]
|
|
|
|
preds = pd.read_csv(path + rf'\{file}', encoding='ISO-8859-1')
|
|
|
|
preds = preds.astype(float)
|
|
|
|
preds = preds[['predicted', 'confidence']]
|
|
|
|
preds = preds[preds['predicted'] == 1.0]
|
|
|
|
preds = preds.astype(float)
|
|
|
|
length = len(preds)
|
|
|
|
preds = preds[preds['predicted'] == 1.0]
|
|
|
|
li = []
|
|
|
|
length = len(preds)
|
|
|
|
zeros = len(preds[preds['confidence'] == 0])
|
|
|
|
li = []
|
|
|
|
dot_02 = len(preds[(preds['confidence'] > 0) & (preds['confidence'] <= 0.2)])
|
|
|
|
zeros = len(preds[preds['confidence'] == 0])
|
|
|
|
dot_24 = len(preds[(preds['confidence'] > 0.2) & (preds['confidence'] <= 0.4)])
|
|
|
|
dot_02 = len(preds[(preds['confidence'] > 0) & (preds['confidence'] <= 0.2)])
|
|
|
|
dot_46 = len(preds[(preds['confidence'] > 0.4) & (preds['confidence'] <= 0.6)])
|
|
|
|
dot_24 = len(preds[(preds['confidence'] > 0.2) & (preds['confidence'] <= 0.4)])
|
|
|
|
dot_68 = len(preds[(preds['confidence'] > 0.6) & (preds['confidence'] <= 0.8)])
|
|
|
|
dot_46 = len(preds[(preds['confidence'] > 0.4) & (preds['confidence'] <= 0.6)])
|
|
|
|
dot_80 = len(preds[(preds['confidence'] > 0.8) & (preds['confidence'] <= 1.0)])
|
|
|
|
dot_68 = len(preds[(preds['confidence'] > 0.6) & (preds['confidence'] <= 0.8)])
|
|
|
|
for number in [zeros, dot_02, dot_24, dot_46, dot_68, dot_80]:
|
|
|
|
dot_80 = len(preds[(preds['confidence'] > 0.8) & (preds['confidence'] <= 1.0)])
|
|
|
|
li.append(round(number * 100 / length, ndigits=3))
|
|
|
|
for number in [zeros, dot_02, dot_24, dot_46, dot_68, dot_80]:
|
|
|
|
|
|
|
|
li.append(round(number * 100 / length, ndigits=3))
|
|
|
|
|
|
|
|
|
|
|
|
c = (
|
|
|
|
c = (
|
|
|
|
Bar(init_opts=opts.InitOpts(theme=ThemeType.WALDEN))
|
|
|
|
Bar(init_opts=opts.InitOpts(theme=ThemeType.WALDEN))
|
|
|
|
.add_xaxis(['conf=0', '0<conf≤0.2', '0.2<conf≤0.4', '0.4<conf≤0.6', '0.6<conf≤0.8', '0.8<conf≤1'])
|
|
|
|
.add_xaxis(['conf=0', '0<conf≤0.2', '0.2<conf≤0.4', '0.4<conf≤0.6', '0.6<conf≤0.8', '0.8<conf≤1'])
|
|
|
|
.add_yaxis(_, li, category_gap=2)
|
|
|
|
.add_yaxis(_, li, category_gap=2)
|
|
|
|
.set_global_opts(
|
|
|
|
.set_global_opts(
|
|
|
|
yaxis_opts=opts.AxisOpts(
|
|
|
|
yaxis_opts=opts.AxisOpts(
|
|
|
|
name="Proportion",
|
|
|
|
name="Proportion",
|
|
|
|
type_="value",
|
|
|
|
type_="value",
|
|
|
|
min_=0,
|
|
|
|
min_=0,
|
|
|
|
max_=100,
|
|
|
|
max_=100,
|
|
|
|
position="left",
|
|
|
|
position="left",
|
|
|
|
axisline_opts=opts.AxisLineOpts(
|
|
|
|
axisline_opts=opts.AxisLineOpts(
|
|
|
|
linestyle_opts=opts.LineStyleOpts()
|
|
|
|
linestyle_opts=opts.LineStyleOpts()
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
axislabel_opts=opts.LabelOpts(formatter="{value}%"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
axislabel_opts=opts.LabelOpts(formatter="{value}%"),
|
|
|
|
title_opts=opts.TitleOpts(title="Confidence Histogram"),
|
|
|
|
),
|
|
|
|
xaxis_opts=opts.AxisOpts(name="Intervals")
|
|
|
|
title_opts=opts.TitleOpts(title="Confidence Histogram"),
|
|
|
|
)
|
|
|
|
xaxis_opts=opts.AxisOpts(name="Intervals")
|
|
|
|
.render(path + r"\confidence_histogram.html")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.render(path + r"\confidence_histogram.html")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|