Negative gradient of partial likelihood

        Parameters
        ---------
        y : tuple, len = 2
            First element is boolean event indicator and second element survival/censoring time.
        y_pred : np.ndarray, shape=(n,):
            The predictions.

def negative_gradient(self, y, y_pred, sample_weight=None, **kwargs):
        """Negative gradient of partial likelihood

        Parameters
        ---------
        y : tuple, len = 2
            First element is boolean event indicator and second element survival/censoring time.
        y_pred : np.ndarray, shape=(n,):
            The predictions.
        """
        pred_time = y['time'] - y_pred.ravel()
        mask = (pred_time > 0) | y['event']
        ret = numpy.zeros(y['event'].shape[0])
        ret[mask] = pred_time.compress(mask, axis=0)
        if sample_weight is not None:
            ret *= sample_weight
        return ret