(self, y, t, calcrange=slice(0, None))
return self.outputs.get().mean(axis=0)
Returns a numpy array with the precision and recall metrics.

        Args:
            y (Tensor or OpTree): Output of previous layer or model (we assume
                                  already binarized, or you need to ensure
                                  binarize is True during construction).
            t (Tensor or OpTree): True targets corresponding to y (we assume
                                  already binarized)

        Returns:
            ndarray: The class averaged precision (item 0) and recall (item
                     1) values.  Per-class statistics remain in self.outputs.
Returns a numpy array with the precision and recall metrics.
Returns a numpy array with the precision and recall metrics .
def __call__(self, y, t, calcrange=slice(0, None)):
        """
        Returns a numpy array with the precision and recall metrics.

        Args:
            y (Tensor or OpTree): Output of previous layer or model (we assume
                                  already binarized, or you need to ensure
                                  binarize is True during construction).
            t (Tensor or OpTree): True targets corresponding to y (we assume
                                  already binarized)

        Returns:
            ndarray: The class averaged precision (item 0) and recall (item
                     1) values.  Per-class statistics remain in self.outputs.
        """
        if self.bin_buf is not None:
            self.be.argmax(y, axis=0, out=self.bin_buf)
            y[:] = self.be.onehot(self.bin_buf, axis=0)
        # True positives
        self.token_stats[:, 0] = self.be.sum(y * t, axis=1)

        # Prediction
        self.token_stats[:, 1] = self.be.sum(y, axis=1)

        # Targets
        self.token_stats[:, 2] = self.be.sum(t, axis=1)

        # Precision
        self.outputs[:, 0] = self.token_stats[:, 0] / (self.token_stats[:, 1] + self.eps)

        # Recall
        self.outputs[:, 1] = self.token_stats[:, 0] / (self.token_stats[:, 2] + self.eps)

        return self.outputs.get().mean(axis=0)
def __call__ ( self , y , t , calcrange = slice ( 0 , None ) ) : if self . bin_buf is not None : self . be . argmax ( y , axis = 0 , out = self . bin_buf ) y [ : ] = self . be . onehot ( self . bin_buf , axis = 0 ) # True positives self . token_stats [ : , 0 ] = self . be . sum ( y * t , axis = 1 ) # Prediction self . token_stats [ : , 1 ] = self . be . sum ( y , axis = 1 ) # Targets self . token_stats [ : , 2 ] = self . be . sum ( t , axis = 1 ) # Precision self . outputs [ : , 0 ] = self . token_stats [ : , 0 ] / ( self . token_stats [ : , 1 ] + self . eps ) # Recall self . outputs [ : , 1 ] = self . token_stats [ : , 0 ] / ( self . token_stats [ : , 2 ] + self . eps ) return self . outputs . get ( ) . mean ( axis = 0 )