def lsr_rankings(n_items, data, alpha=<NUM_LIT:0.0>, initial_params=None):
weights, chain = _init_lsr(n_items, alpha, initial_params)<EOL>for ranking in data:<EOL><INDENT>sum_ = weights.take(ranking).sum()<EOL>for i, winner in enumerate(ranking[:-<NUM_LIT:1>]):<EOL><INDENT>val = <NUM_LIT:1.0> / sum_<EOL>for loser in ranking[i+<NUM_LIT:1>:]:<EOL><INDENT>chain[loser, winner] += val<EOL><DEDENT>sum_ -= weights[winner]<EOL><DEDENT><DEDENT>chain -= np.diag(chain.sum(axis=<NUM_LIT:1>))<EOL>return log_transform(statdist(chain))<EOL>
Compute the LSR estimate of model parameters.

    This function implements the Luce Spectral Ranking inference algorithm
    [MG15]_ for ranking data (see :ref:`data-rankings`).

    The argument ``initial_params`` can be used to iteratively refine an
    existing parameter estimate (see the implementation of
    :func:`~choix.ilsr_rankings` for an idea on how this works). If it is set
    to `None` (the default), the all-ones vector is used.

    The transition rates of the LSR Markov chain are initialized with
    ``alpha``. When ``alpha > 0``, this corresponds to a form of regularization
    (see :ref:`regularization` for details).

    Parameters
    ----------
    n_items : int
        Number of distinct items.
    data : list of lists
        Ranking data.
    alpha : float, optional
        Regularization parameter.
    initial_params : array_like, optional
        Parameters used to build the transition rates of the LSR Markov chain.

    Returns
    -------
    params : numpy.ndarray
        An estimate of model parameters.