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()
Beispiel #2
0
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())
Beispiel #3
0
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())
Beispiel #4
0
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())
Beispiel #5
0
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)
Beispiel #6
0
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())
Beispiel #7
0
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())
Beispiel #8
0
def test_fitting_error():
    X1 = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
    mc = MeanCenterer()
    mc.transform(X1)
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)