def test_mean_centering(): X1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) X1_out = np.array([[-1.0, -1.0, -1.0], [1.0, 1.0, 1.0]]) mc = MeanCenterer() assert mc.fit_transform(X1).all() == X1_out.all() X2 = [1.0, 2.0, 3.0] X2_out = np.array([-1.0, 0.0, 1.0]) mc = MeanCenterer() assert mc.fit_transform(X2).all().all() == X2_out.all()
def test_mean_centering(): X1 = np.array([[1,2,3], [4,5,6]]) X1_out = np.array([[-1, -1, -1], [ 1, 1, 1]]) mc = MeanCenterer() assert(mc.fit_transform(X1).all() == X1_out.all()) X2 = [1, 2, 3] X2_out = np.array([-1, 0, 1]) mc = MeanCenterer() assert(mc.fit_transform(X2).all().all() == X2_out.all())
def test_mean_centering(): X1 = np.array([[1, 2, 3], [4, 5, 6]]) X1_out = np.array([[-1, -1, -1], [1, 1, 1]]) mc = MeanCenterer() assert (mc.fit_transform(X1).all() == X1_out.all()) X2 = [1, 2, 3] X2_out = np.array([-1, 0, 1]) mc = MeanCenterer() assert (mc.fit_transform(X2).all().all() == X2_out.all())
def test_list_mean_centering(): X2 = [1.0, 2.0, 3.0] X2_out = np.array([-1.0, 0.0, 1.0]) mc = MeanCenterer() assert(mc.fit_transform(X2).all().all() == X2_out.all())
def test_fitting_error(): X1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) mc = MeanCenterer() with pytest.raises(AttributeError): mc.transform(X1)
def test_array_mean_centering(): X1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) X1_out = np.array([[-1.0, -1.0, -1.0], [1.0, 1.0, 1.0]]) mc = MeanCenterer() assert(mc.fit_transform(X1).all() == X1_out.all())
def test_fitting_error(): X1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) mc = MeanCenterer() mc.transform(X1)