How to use the sciunit.scores.ZScore function in sciunit

To help you get started, we’ve selected a few sciunit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scidash / sciunit / sciunit / unit_test / converter_tests.py View on Github external
def test_converters(self):
        from sciunit.converters import NoConversion,LambdaConversion,\
                                       AtMostToBoolean,AtLeastToBoolean,\
                                       RangeToBoolean
        from sciunit.scores import BooleanScore,ZScore

        old_score = ZScore(1.3)
        new_score = NoConversion().convert(old_score)
        self.assertEqual(old_score,new_score)
        new_score = LambdaConversion(lambda x:x.score**2).convert(old_score)
        self.assertEqual(old_score.score**2,new_score.score)
        new_score = AtMostToBoolean(3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = AtMostToBoolean(1).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
        new_score = AtLeastToBoolean(1).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = AtLeastToBoolean(3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
        new_score = RangeToBoolean(1,3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = RangeToBoolean(3,5).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
github scidash / sciunit / sciunit / unit_test / score_tests.py View on Github external
def test_regular_score_types_1(self):
        score = PercentScore(42)
        self.assertEqual(score.norm_score, 0.42)

        ZScore(0.7)
        score = ZScore.compute({'mean': 3., 'std': 1.},
                               {'value': 2.})
        self.assertEqual(score.score, -1.)

        CohenDScore(-0.3)
        score = CohenDScore.compute({'mean': 3., 'std': 1.},
                                    {'mean': 2., 'std': 1.})
        self.assertTrue(-0.708 < score.score < -0.707)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
score.describe()

        score = FloatScore(3.14)
        obs = np.array([1.0,2.0,3.0])
        pred = np.array([1.0,2.0,4.0])
        score = FloatScore.compute_ssd(obs,pred)
        self.assertEqual(score.score,1.0)
        
        RatioScore(1.2)
        score = RatioScore.compute({'mean':4.,'std':1.},{'value':2.})
        self.assertEqual(score.score,0.5)

        score = PercentScore(42)
        self.assertEqual(score.sort_key,0.42)

        ZScore(0.7)
        score = ZScore.compute({'mean':3.,'std':1.},{'value':2.})
        self.assertEqual(score.score,-1.)

        CohenDScore(-0.3)
        score = CohenDScore.compute({'mean':3.,'std':1.},{'mean':2.,'std':1.})
        self.assertTrue(-0.708 < score.score < -0.707)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
score = FloatScore(3.14)
        obs = np.array([1.0,2.0,3.0])
        pred = np.array([1.0,2.0,4.0])
        score = FloatScore.compute_ssd(obs,pred)
        self.assertEqual(score.score,1.0)
        
        RatioScore(1.2)
        score = RatioScore.compute({'mean':4.,'std':1.},{'value':2.})
        self.assertEqual(score.score,0.5)

        score = PercentScore(42)
        self.assertEqual(score.sort_key,0.42)

        ZScore(0.7)
        score = ZScore.compute({'mean':3.,'std':1.},{'value':2.})
        self.assertEqual(score.score,-1.)

        CohenDScore(-0.3)
        score = CohenDScore.compute({'mean':3.,'std':1.},{'mean':2.,'std':1.})
        self.assertTrue(-0.708 < score.score < -0.707)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
def test_converters(self):
        from sciunit.converters import NoConversion,LambdaConversion,\
                                       AtMostToBoolean,AtLeastToBoolean,\
                                       RangeToBoolean
        from sciunit.scores import BooleanScore,ZScore

        old_score = ZScore(1.3)
        new_score = NoConversion().convert(old_score)
        self.assertEqual(old_score,new_score)
        new_score = LambdaConversion(lambda x:x.score**2).convert(old_score)
        self.assertEqual(old_score.score**2,new_score.score)
        new_score = AtMostToBoolean(3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = AtMostToBoolean(1).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
        new_score = AtLeastToBoolean(1).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = AtLeastToBoolean(3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
        new_score = RangeToBoolean(1,3).convert(old_score)
        self.assertEqual(new_score,BooleanScore(True))
        new_score = RangeToBoolean(3,5).convert(old_score)
        self.assertEqual(new_score,BooleanScore(False))
github scidash / sciunit / sciunit / unit_test / score_tests.py View on Github external
def test_regular_score_types_1(self):
        score = PercentScore(42)
        self.assertEqual(score.norm_score, 0.42)

        ZScore(0.7)
        score = ZScore.compute({'mean': 3., 'std': 1.},
                               {'value': 2.})
        self.assertEqual(score.score, -1.)

        CohenDScore(-0.3)
        score = CohenDScore.compute({'mean': 3., 'std': 1.},
                                    {'mean': 2., 'std': 1.})
        self.assertTrue(-0.708 < score.score < -0.707)