(self, weights, y)
return -prets.kthvalue(k)[0]
Compute negative quantile.

        Parameters
        ----------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.

        y : torch.Tensor
            Tensor of shape `(n_samples, n_channels, horizon, n_assets)` representing the evolution over the next
            `horizon` timesteps.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples,)` representing the per sample negative quantile.
Compute negative quantile.
Compute negative quantile .
def __call__(self, weights, y):
        """Compute negative quantile.

        Parameters
        ----------
        weights : torch.Tensor
            Tensor of shape `(n_samples, n_assets)` representing the predicted weights by our portfolio optimizer.

        y : torch.Tensor
            Tensor of shape `(n_samples, n_channels, horizon, n_assets)` representing the evolution over the next
            `horizon` timesteps.

        Returns
        -------
        torch.Tensor
            Tensor of shape `(n_samples,)` representing the per sample negative quantile.

        """
        prets = portfolio_returns(weights,
                                  y[:, self.returns_channel, ...])  # (n_samples, horizon)

        _, horizon = prets.shape

        k = 1 + round(self.q * (horizon - 1))
        return -prets.kthvalue(k)[0]
def __call__ ( self , weights , y ) : prets = portfolio_returns ( weights , y [ : , self . returns_channel , ... ] ) # (n_samples, horizon) _ , horizon = prets . shape k = 1 + round ( self . q * ( horizon - 1 ) ) return - prets . kthvalue ( k ) [ 0 ]