(self, weights, y)
return torch.sqrt(
            torch.mean(
                torch.relu(-prets.sub(prets.mean(dim=1)[:, None])) ** self.beta, dim=1
            )
        )
Compute the downside risk.

        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 downside risk.
Compute the downside risk.
Compute the downside risk .
def __call__(self, weights, y):
        """Compute the downside risk.

        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 downside risk.

        """
        prets = portfolio_returns(
            weights,
            y[:, self.returns_channel, ...],
            input_type=self.input_type,
            output_type=self.output_type,
        )

        return torch.sqrt(
            torch.mean(
                torch.relu(-prets.sub(prets.mean(dim=1)[:, None])) ** self.beta, dim=1
            )
        )
def __call__ ( self , weights , y ) : prets = portfolio_returns ( weights , y [ : , self . returns_channel , ... ] , input_type = self . input_type , output_type = self . output_type , ) return torch . sqrt ( torch . mean ( torch . relu ( - prets . sub ( prets . mean ( dim = 1 ) [ : , None ] ) ) ** self . beta , dim = 1 ) )