def windowSequenceEval(DS, winsz, result):
    """ take results of a window-based classification and assess/plot them on the sequence
    WARNING: NOT TESTED!"""
    si_old = 0
    idx = 0
    x = []
    y = []
    seq_res = []
    for i, si in enumerate(DS['sequence_index'][1:].astype(int)):
        tar = DS['target'][si - 1]
        curr_x = si_old
        correct = 0.
        wrong = 0.
        while curr_x < si:
            x.append(curr_x)
            if result[idx] == tar:
                correct += 1.
                y += [1., 1.]
            else:
                wrong += 1.
                y += [0., 0.]
            idx += 1
            #print("winidx: ", idx)
            curr_x += winsz
            x.append(curr_x)

        seq_res.append(100. * correct / (correct + wrong))
        print(("sequence %d correct: %g12.2%%" % (i, seq_res[-1])))

    seq_res = array(seq_res)
    print(("total fraction of correct sequences: ", 100. * float((seq_res >= 0.5).sum()) / seq_res.size))
dataset/ETHPy150Open pybrain/pybrain/pybrain/tools/datasettools.py/windowSequenceEval/original