Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum_predicted0 = 0.0
- sum_groundtruth0 = 0.0
- for i in range(df0.shape[0]):
- probs = array([float(df0.iloc[i]['p(T1)'])*100,
- float(df0.iloc[i]['p(T2)'])*100,
- float(df0.iloc[i]['p(T3)'])*100,
- float(df0.iloc[i]['p(T4)'])*100,
- float(df0.iloc[i]['p(T5)'])*100,
- float(df0.iloc[i]['p(T6)'])*100,
- float(df0.iloc[i]['p(T7)'])*100,
- float(df0.iloc[i]['p(T8)'])*100,
- float(df0.iloc[i]['p(T9)'])*100])
- sum_predicted0 += math.log(np.max(probs))
- if fold0.iloc[i]['Q3 Theme'] == 1:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T1)'])
- elif fold0.iloc[i]['Q3 Theme'] == 2:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T2)'])
- elif fold0.iloc[i]['Q3 Theme'] == 3:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T3)'])
- elif fold0.iloc[i]['Q3 Theme'] == 4:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T4)'])
- elif fold0.iloc[i]['Q3 Theme'] == 5:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T5)'])
- elif fold0.iloc[i]['Q3 Theme'] == 6:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T6)'])
- elif fold0.iloc[i]['Q3 Theme'] == 7:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T7)'])
- elif fold0.iloc[i]['Q3 Theme'] == 8:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T8)'])
- elif fold0.iloc[i]['Q3 Theme'] == 9:
- sum_groundtruth0 += math.log(df0.iloc[i]['p(T9)'])
- avg_predicted = (-sum_predicted0/df0.shape[0] +
- -sum_predicted1/df1.shape[0] +
- -sum_predicted2/df2.shape[0] +
- -sum_predicted3/df3.shape[0] +
- -sum_predicted4/df4.shape[0] +
- -sum_predicted5/df5.shape[0] +
- -sum_predicted6/df6.shape[0] +
- -sum_predicted7/df7.shape[0] +
- -sum_predicted8/df8.shape[0] +
- -sum_predicted9/df9.shape[0]
- ) / 10
- avg_gt = (-sum_groundtruth0/df0.shape[0] +
- -sum_groundtruth1/df1.shape[0] +
- -sum_groundtruth2/df2.shape[0] +
- -sum_groundtruth3/df3.shape[0] +
- -sum_groundtruth4/df4.shape[0] +
- -sum_groundtruth5/df5.shape[0] +
- -sum_groundtruth6/df6.shape[0] +
- -sum_groundtruth7/df7.shape[0] +
- -sum_groundtruth8/df8.shape[0] +
- -sum_groundtruth9/df9.shape[0]) /10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement