Numpy: Masked elements in computation
问题 I have a function to built a polynomial from a given x: [1, x^2,x^3,x^4,...,x^degree] def build_poly(x, degree): """polynomial basis functions for input data x, for j=0 up to j=degree.""" D = len(x) polyome = np.ones((D, 1)) for i in range(1, degree+1): polyome = np.c_[polyome, x**i] return polyome Now, I would like to calculate polynom for a given x, but omiting sume values. Hence, what this is what I did: Created X: x=np.array([[1,2,3],[4,5,6]])]) I masked away the value with I wanted to