예제 #1
0
    def test_keras_metric(self):
        try:
            from keras.metrics import MeanAbsoluteError
            Scorer.register_custom_metric(MeanAbsoluteError)

            Scorer.register_custom_metric('any_weird_metric')
        except ImportError:
            pass
예제 #2
0
    def test_doubled_custom_metric(self):

        def custom_metric(y_true, y_pred):
            return 99.9

        Scorer.register_custom_metric(('a_custom_metric', custom_metric))

        with self.assertRaises(Warning):
            Scorer.register_custom_metric(('a_custom_metric', custom_metric))

        with self.assertRaises(ValueError):
            Scorer.register_custom_metric(None)