def generate_rankings(params, n_rankings, size=<NUM_LIT:3>):
n = len(params)<EOL>items = tuple(range(n))<EOL>params = np.asarray(params)<EOL>data = list()<EOL>for _ in range(n_rankings):<EOL><INDENT>alts = random.sample(items, size)<EOL>ranking = compare(alts, params, rank=True)<EOL>data.append(ranking)<EOL><DEDENT>return tuple(data)<EOL>
Generate rankings according to a Plackett--Luce model.

    This function samples subsets of items (of size ``size``) independently and
    uniformly at random, and samples the correspoding partial ranking from a
    Plackett--Luce model parametrized by ``params``.

    Parameters
    ----------
    params : array_like
        Model parameters.
    n_rankings : int
        Number of rankings to generate.
    size : int, optional
        Number of items to include in each ranking.

    Returns
    -------
    data : list of numpy.ndarray
        A list of (partial) rankings generated according to a Plackett--Luce
        model with the specified model parameters.