MarginRankingLoss — PyTorch 1.11.0 documentation
pytorch.org › docs › stableMarginRankingLoss — PyTorch 1.11.0 documentation MarginRankingLoss class torch.nn.MarginRankingLoss(margin=0.0, size_average=None, reduce=None, reduction='mean') [source] Creates a criterion that measures the loss given inputs x1 x1, x2 x2, two 1D mini-batch or 0D Tensors , and a label 1D mini-batch or 0D Tensor y y (containing 1 or -1). If
Fast, differentiable sorting and ranking in PyTorch
pythonawesome.com › fast-differentiable-sortingMar 27, 2021 · import torch import torchsort def spearmanr(pred, target, **kw): pred = torchsort.soft_rank(pred, **kw) target = torchsort.soft_rank(target, **kw) pred = pred - pred.mean() pred = pred / pred.norm() target = target - target.mean() target = target / target.norm() return (pred * target).sum() pred = torch.tensor([[1., 2., 3., 4., 5.]], requires_grad=True) target = torch.tensor([[5., 6., 7., 8., 7.]]) spearman = spearmanr(pred, target) # tensor(0.8321) torch.autograd.grad(spearman, pred ...
torch.matrix_rank — PyTorch 1.11.0 documentation
pytorch.org › generated › torchtorch.matrix_rank torch.matrix_rank(input, tol=None, symmetric=False, *, out=None) → Tensor Returns the numerical rank of a 2-D tensor. The method to compute the matrix rank is done using SVD by default. If symmetric is True , then input is assumed to be symmetric, and the computation of the rank is done by obtaining the eigenvalues.
allRank : Learning to Rank in PyTorch - GitHub
https://github.com/allegro/allRank17.05.2021 · allRank is a PyTorch-based framework for training neural Learning-to-Rank (LTR) models, featuring implementations of: common pointwise, pairwise and listwise loss functions fully connected and Transformer-like scoring functions commonly used evaluation metrics like Normalized Discounted Cumulative Gain (NDCG) and Mean Reciprocal Rank (MRR)
torch.linalg.matrix_rank — PyTorch 1.11.0 documentation
pytorch.org › torchtorch.linalg.matrix_rank(A, *, atol=None, rtol=None, hermitian=False, out=None) → Tensor. Computes the numerical rank of a matrix. The matrix rank is computed as the number of singular values (or eigenvalues in absolute value when hermitian= True ) that are greater than. max ( atol, σ 1 ∗ rtol)
GitHub - wildltr/ptranking: Learning to Rank in PyTorch
github.com › wildltr › ptrankingFeb 22, 2022 · This open-source project, referred to as PTRanking (Learning-to-Rank in PyTorch) aims to provide scalable and extendable implementations of typical learning-to-rank methods based on PyTorch. On one hand, this project enables a uniform comparison over several benchmark datasets leading to an in-depth understanding of previous learning-to-rank methods.