Beispiel #1
0
    def test_skewed(self):
        np.random.seed(1312)

        bins, n = auto_derived_lags(np.random.gamma(10, 20, 500), 'doane', 100)

        # doane should condense to 6 here
        self.assertTrue(n == 6)

        assert_array_almost_equal(bins,
                                  np.array(
                                      [75.6, 80.4, 85.3, 90.2, 95.1, 100.]),
                                  decimal=1)
Beispiel #2
0
    def test_auto(self):
        np.random.seed(42)

        bins, n = auto_derived_lags(np.random.normal(10, 2, 1000), 'sturges',
                                    None)

        # sturges should find 11 classes
        self.assertTrue(n == 11)

        assert_array_almost_equal(bins,
                                  np.array([
                                      4.8, 6.1, 7.4, 8.7, 10., 11.3, 12.5,
                                      13.8, 15.1, 16.4, 17.7
                                  ]),
                                  decimal=1)