pyepo.func.rank =============== .. py:module:: pyepo.func.rank .. autoapi-nested-parse:: Learning to rank Losses Attributes ---------- .. autoapisummary:: pyepo.func.rank.lsLTR pyepo.func.rank.prLTR pyepo.func.rank.ptLTR Classes ------- .. autoapisummary:: pyepo.func.rank.listwiseLearningToRank pyepo.func.rank.pairwiseLearningToRank pyepo.func.rank.pointwiseLearningToRank Module Contents --------------- .. py:class:: listwiseLearningToRank(optmodel: pyepo.model.opt.optModel, processes: int = 1, solve_ratio: float = 1.0, reduction: pyepo.func.abcmodule.Reduction = 'mean', dataset: pyepo.data.dataset.optDataset | None = None) Bases: :py:obj:`pyepo.func.abcmodule.optModule` Listwise Learning-to-Rank loss over a cached solution pool. Models the ranking distribution over the cached pool :math:`\Gamma` as SoftMax of predicted-cost scores and minimizes its cross-entropy against the true ranking distribution. The full-list formulation captures interactions between every pair of solutions in :math:`\Gamma`. Pool semantics (``solve_ratio``, ``dataset``) are shared with the other LTR variants and with the contrastive methods. Reference: Mandi et al. (2022) ``_ .. py:method:: forward(pred_cost: torch.Tensor, true_cost: torch.Tensor) -> torch.Tensor Forward pass .. py:class:: pairwiseLearningToRank(optmodel: pyepo.model.opt.optModel, processes: int = 1, solve_ratio: float = 1.0, reduction: pyepo.func.abcmodule.Reduction = 'mean', dataset: pyepo.data.dataset.optDataset | None = None) Bases: :py:obj:`pyepo.func.abcmodule.optModule` Pairwise Learning-to-Rank loss over a cached solution pool. Enforces a margin between the true optimum (the best member of :math:`\Gamma`) and each suboptimal solution via a ReLU hinge on the predicted-cost difference. Lighter than the listwise variant (no SoftMax over the full pool) and often a good first choice when the pool is large. Pool semantics (``solve_ratio``, ``dataset``) are shared with the other LTR variants and with the contrastive methods. Reference: Mandi et al. (2022) ``_ .. py:attribute:: relu .. py:method:: forward(pred_cost: torch.Tensor, true_cost: torch.Tensor) -> torch.Tensor Forward pass .. py:class:: pointwiseLearningToRank(optmodel: pyepo.model.opt.optModel, processes: int = 1, solve_ratio: float = 1.0, reduction: pyepo.func.abcmodule.Reduction = 'mean', dataset: pyepo.data.dataset.optDataset | None = None) Bases: :py:obj:`pyepo.func.abcmodule.optModule` Pointwise Learning-to-Rank loss over a cached solution pool. Treats each cached solution :math:`\mathbf{w} \in \Gamma` as an independent regression target: the predicted score :math:`\hat{\mathbf{c}}^\top \mathbf{w}` is fit toward the true score :math:`\mathbf{c}^\top \mathbf{w}` via squared error, averaged over the pool. Cheapest of the three LTR variants -- no cross-pool interactions. Pool semantics (``solve_ratio``, ``dataset``) are shared with the other LTR variants and with the contrastive methods. Reference: Mandi et al. (2022) ``_ .. py:method:: forward(pred_cost: torch.Tensor, true_cost: torch.Tensor) -> torch.Tensor Forward pass .. py:data:: lsLTR .. py:data:: prLTR .. py:data:: ptLTR