✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
An equation like y = Xh can be solved by inversion of X (i.e., h = X-1y ). And, it can be solved manually or using Python libraries, when the X is square). But, if X is not square or invertible then there is a well known recipe to solve the system approximately called the pseudo inverse (i.e., Ordinary Least Squares, )
Using the below Python references, drag and drop a code for solving the ĥ, assuming X and y are numpy arrays/matrices, and all required modules are imported.
numpy.linalg.inv(a) Compute the (multiplicative) inverse of a matrix.numpy.linalg.pinv(a) //fyi, the second parameter can not be considered Compute the (Moore-Penrose) pseudo-inverse of a matrix.numpy.dot(a, b, out=None) Dot product of two arrays.numpy.transpose(a, axes=None) Permute the dimensions of an array.numpy.ndarray.T Same as self.transpose(), except that self is returned if self.ndim < 2.