Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -79,6 +79,7 @@ def onset_rocloc(ltru, lexp, eps): · 78 unmodified lines | |||
| 79 | """ | 79 | """ |
| 80 | orig, expc = len(ltru), len(lexp) | 80 | orig, expc = len(ltru), len(lexp) |
| 81 | l = [] | 81 | l = [] |
| 82 | labs = [] | ||
| 82 | mean = 0 | 83 | mean = 0 |
| 83 | # if lexp is empty | 84 | # if lexp is empty |
| 84 | if expc == 0 : return orig,orig,0,0,0,0,l,mean | 85 | if expc == 0 : return orig,orig,0,0,0,0,l,mean |
| @@ -97,11 +98,12 @@ def onset_rocloc(ltru, lexp, eps): · 12 unmodified lines | |||
| 97 | if abs(x-y) <= eps: | 98 | if abs(x-y) <= eps: |
| 98 | correspond += 1 | 99 | correspond += 1 |
| 99 | l.append(y-x) | 100 | l.append(y-x) |
| 101 | labs.append(abs(y-x)) | ||
| 100 | if correspond == 0: bad += 1 | 102 | if correspond == 0: bad += 1 |
| 101 | elif correspond > 1: merged += correspond - 1 | 103 | elif correspond > 1: merged += correspond - 1 |
| 102 | # check consistancy of the results | 104 | # check consistancy of the results |
| 103 | assert ( orig - missed - merged == expc - bad - doubled) | 105 | assert ( orig - missed - merged == expc - bad - doubled) |
| 104 | return orig, missed, merged, expc, bad, doubled, l, sum(l)/float(max(len(l),1)) | 106 | return orig, missed, merged, expc, bad, doubled, l, labs |
| 105 | 107 | ||
| 106 | def notes_roc (la, lb, eps): | 108 | def notes_roc (la, lb, eps): |
| 107 | from numarray import transpose, add, resize | 109 | from numarray import transpose, add, resize |