def test_explicit_linear_algebra_solution_01(self): input_array = np.array([[0, 1], [1, 4], [2, 9], [3, 16], [4, 25], [5, 36], [6, 49], [7, 64], [8, 81], [9, 100]]) x = input_array[:, 0] y = input_array[:, 1] x_vector = np.zeros((x.shape[0], 3)) x_vector[:, 0] = x[:, ]**2 x_vector[:, 1] = x[:, ] x_vector[:, 2] = 1 expected_value = np.array([[1.], [2.], [1.]]).reshape(3, ) output_1 = RadialBasisFunctions.explicit_linear_algebra_solution( x_vector, y) np.testing.assert_array_equal(expected_value, np.round(output_1, 4))
def test_explicit_linear_algebra_solution_02(self): x = self.training_data[:, :-1] y = self.training_data[:, -1] x_vector = np.zeros((x.shape[0], 6)) x_vector[:, 0] = x[:, 0]**2 x_vector[:, 1] = x[:, 1]**2 x_vector[:, 2] = x[:, 0] x_vector[:, 3] = x[:, 1] x_vector[:, 4] = x[:, 1] * x[:, 0] x_vector[:, 5] = 1 expected_value = np.array([[1.], [1.], [2.], [2.], [0.], [2.]]).reshape(6, ) output_1 = RadialBasisFunctions.explicit_linear_algebra_solution( x_vector, y) np.testing.assert_array_equal(expected_value, np.round(output_1, 4))