def _bayes_estimator()

in src/alpaca_eval/metrics.py [0:0]


    def _bayes_estimator(self, predictions):
        # if all the values are 0.0, 1.0, 2.0, nan, or 1.5 then for backward compatibility we return the random mode
        # note that this doesn't change the expected value of the estimator, but increases the variance. The new version
        # is thus better
        if pd.Series(predictions.unique()).isin([0.0, 1.0, 2.0, np.nan, 1.5]).all():
            return _random_mode(predictions)

        return predictions.median()