def test_iqr_empty(self): empty = np.empty(0) assert np.isnan(scale.iqr(empty)) empty = np.empty((10, 100, 0)) assert_equal(scale.iqr(empty, axis=1), np.empty((10, 0))) empty = np.empty((100, 100, 0, 0)) assert_equal(scale.iqr(empty, axis=-1), np.empty((100, 100, 0)))
def test_qn_empty(self): empty = np.empty(0) assert np.isnan(scale.qn_scale(empty)) empty = np.empty((10, 100, 0)) assert_equal(scale.qn_scale(empty, axis=1), np.empty((10, 0))) empty = np.empty((100, 100, 0, 0)) assert_equal(scale.qn_scale(empty, axis=-1), np.empty((100, 100, 0))) empty = np.empty(shape=()) with pytest.raises(ValueError): scale.iqr(empty)
def test_iqr(self): assert_almost_equal(scale.iqr(self.chem), 0.68570, DECIMAL)
def test_axisneg1(self): m = scale.iqr(self.X, axis=-1) assert_equal(m.shape, (40, 10))
def test_axis2(self): m = scale.iqr(self.X, axis=2) assert_equal(m.shape, (40, 10))
def test_axis1(self): m = scale.iqr(self.X, axis=1) assert_equal(m.shape, (40, 30))
def test_axis0(self): m = scale.iqr(self.X, axis=0) assert_equal(m.shape, (10, 30))
def test_iqr(self): m = scale.iqr(self.X) assert_equal(m.shape, (10, ))
def test_iqr_center(self): n = scale.iqr(self.X, center=0) assert_equal(n.shape, (10,))