def test_create_centres_03(self): initial_centres = np.array([[0, 0], [1, 1]]) current_random_points = np.array([[0.6, 0.6], [0.8, 0.8]]) current_centres = np.array([1, 1]) counter = 5 expected_output = np.array([[0.5 / 6, 0.5 / 6], [5.7 / 6, 5.7 / 6]]) output = CVTSampling.create_centres(initial_centres, current_random_points, current_centres, counter) np.testing.assert_array_equal(expected_output, output)
def test_create_centres_02(self): initial_centres = np.array([[0, 0], [1, 1]]) current_random_points = np.array([[0.6, 0.6], [0.3, 0.3]]) current_centres = np.array([1, 0]) counter = 10 expected_output = np.array([[0.3 / 11, 0.3 / 11], [10.6 / 11, 10.6 / 11]]) output = CVTSampling.create_centres(initial_centres, current_random_points, current_centres, counter) np.testing.assert_array_equal(expected_output, output)
def test_create_centres_04(self): initial_centres = np.array([[0, 0, 0], [1, 1, 1]]) current_random_points = np.array([[0.1, 0.1, 0.1], [0.3, 0.3, 0.3], [0.5, 0.5, 0.5], [0.7, 0.7, 0.7], [0.9, 0.9, 0.9]]) current_centres = np.array([0, 0, 0, 1, 1]) counter = 4 expected_output = np.array([[0.3 / 5, 0.3 / 5, 0.3 / 5], [4.8 / 5, 4.8 / 5, 4.8 / 5]]) output = CVTSampling.create_centres(initial_centres, current_random_points, current_centres, counter) np.testing.assert_array_equal(expected_output, output)