def _pl_sample(t, ?):
"""
Sample from the plackett luce distribution directly
:param t: The target labels
:return: A random permutation from the plackett-luce distribution
parameterized by the target labels
"""
xp = cuda.get_array_module(t)
t = t[:, 0]
probs = xp.exp(t * ?)
probs /= xp.sum(probs)
return xp.random.choice(probs.shape[0], probs.shape[0], replace=False,
p=probs)
评论列表
文章目录