Пример #1
0
def test_mdr_fit_transform():
    """Ensure that the MDR 'fit_transform' function combines both fit and transform, and produces the right predicted labels"""
    features = np.array([[2, 0], [0, 0], [0, 1], [0, 0], [0, 0], [0,
                                                                  0], [0, 1],
                         [0, 0], [0, 0], [0, 1], [0, 0], [0, 0], [0, 0],
                         [1, 1], [1, 1]])

    classes = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0])

    mdr = MDR()
    new_features = mdr.fit_transform(features, classes)
    assert np.array_equal(new_features,
                          [[1], [1], [1], [1], [1], [1], [1], [1], [1], [1],
                           [1], [1], [1], [0], [0]])
Пример #2
0
def test_fit_transform():
	"""Ensure that the MDR 'fit_transform' method combines both fit and transform, and produces the right predicted labels"""
	features = np.array([[2,0],
						[0,	0],
						[0,	1],
						[0,	0],
						[0,	0],
						[0,	0],
						[0,	1],
						[0,	0],
						[0,	0],
						[0,	1],
						[0,	0],
						[0,	0],
						[0,	0],
						[1,	1],
						[1,	1]])

	classes = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0])

	mdr = MDR() 
	new_features = mdr.fit_transform(features, classes)
	assert np.array_equal(new_features, [1,0,1,0,0,0,1,0,0,1,0,0,0,0,0])