def _mm_top1(n_items, data, params):
weights = exp_transform(params)<EOL>wins = np.zeros(n_items, dtype=float)<EOL>denoms = np.zeros(n_items, dtype=float)<EOL>for winner, losers in data:<EOL><INDENT>wins[winner] += <NUM_LIT:1><EOL>val = <NUM_LIT:1> / (weights.take(losers).sum() + weights[winner])<EOL>for item in itertools.chain([winner], losers):<EOL><INDENT>denoms[item] += val<EOL><DEDENT><DEDENT>return wins, denoms<EOL>
Inner loop of MM algorithm for top1 data.