def test_pyomo_optimization_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.]]) output_1 = RadialBasisFunctions.pyomo_optimization(x_vector, y) np.testing.assert_array_equal(expected_value, np.round(output_1, 4))
def test_pyomo_optimization_01(): # Create x vector for ax2 + bx + c: x data supplied in x_vector 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.]]) output_1 = RadialBasisFunctions.pyomo_optimization(x_vector, y) np.testing.assert_array_equal(expected_value, np.round(output_1, 4))