def test_harrelldavis(self): """Test Harrel-Davis estimation of :math:`q^{th}` quantile. """ a = [ 77, 87, 88, 114, 151, 210, 219, 246, 253, 262, 296, 299, 306, 376, 428, 515, 666, 1310, 2611 ] assert harrelldavis(a, quantile=0.5) == 271.72120054908913 harrelldavis(x=x, quantile=np.arange(0.1, 1, 0.1)) assert harrelldavis(a, [0.25, 0.5, 0.75])[1] == 271.72120054908913
def test_harrelldavis(self): """Test Harrel-Davis estimation of :math:`q^{th}` quantile. """ a = [77, 87, 88, 114, 151, 210, 219, 246, 253, 262, 296, 299, 306, 376, 428, 515, 666, 1310, 2611] assert harrelldavis(a, quantile=0.5) == 271.72120054908913 harrelldavis(x=x, quantile=np.arange(0.1, 1, 0.1)) assert harrelldavis(a, [0.25, 0.5, 0.75])[1] == 271.72120054908913 # Test multiple axis p = np.random.normal(0, 1, (10, 100)) def func(a, axes): return harrelldavis(a, [0.25, 0.75], axes) np.testing.assert_array_almost_equal(harrelldavis(p, [0.25, 0.75], 0), np.apply_over_axes(func, p, 0)) np.testing.assert_array_almost_equal(harrelldavis(p, [0.25, 0.75], -1), np.apply_over_axes(func, p, 1))
def func(a, axes): return harrelldavis(a, [0.25, 0.75], axes)