f.close() file2open = 'essays/bad/{}'.format(number + 1) f = codecs.open(file2open, 'r', encoding='utf-8') essay = f.read() bad_buffer = model.calculate_score(essay) bad_buffer = int(round(float(bad_buffer))) print(bad_buffer) scores.append(bad_buffer) # if bad_buffer == 1: # gts.append(1) # elif bad_buffer == 0: # gts.append(0) # else: if flag_b % 2 == 1: gts.append(3) else: gts.append(3) flag_b = flag_b + 1 print("appending...(" + str(round(float( (number + 1)) / 30.0 * 100, 1)) + "% completed)") f.close() print scores print gts final = qwk(scores, gts) print('qwk = ' + str(final))
def quadratic_weighted_kappa(rater_a, rater_b, min_rating, max_rating): assert_inputs(rater_a, rater_b) return qwk(rater_a, rater_b, min_rating, max_rating)
def ikappa(t, x, minmax=None): if minmax is None: return qwk(t, x) minmax = np.array(minmax, np.int32) return qwk(t, x, minmax.min(), minmax.max())