Returns the vector with feature weights normalized so that their sum is 1.0 (in-place).
(v)
| 672 | _features = features |
| 673 | |
| 674 | def relative(v): |
| 675 | """ Returns the vector with feature weights normalized so that their sum is 1.0 (in-place). |
| 676 | """ |
| 677 | n = float(sum(v.itervalues())) or 1.0 |
| 678 | s = dict.__setitem__ |
| 679 | for f in v: # Modified in-place. |
| 680 | s(v, f, v[f] / n) |
| 681 | return v |
| 682 | |
| 683 | rel = relative |
| 684 |
nothing calls this directly
no test coverage detected
searching dependent graphs…