For example, I am trying to perform linear regression on the following set of data
Data examples: $X = [[1, 20], [3, 40], [5, 60]]$ (each row is an example, there are three examples, each with a feature of $2$, arranged in Numpy array)
Targets: $y = [1, 2, 3]$ (whatever you like, it doesn't affect our result.
Fitting a standardscaler gives me,
X = [[1, 20], [3, 40], [5, 60]]
scaler = StandardScaler()
scaler.fit(X)
Y = scaler.transform(X)
$Y = [[-1.22474487 -1.22474487] [ 0. 0. ] [ 1.22474487 1.22474487]]$
Now I want to compute the normal equation of a linear regression problem. This inolves calculating the following matrix $Z = (Y^T Y)^{-1} Y^T$
Z = np.linalg.inv(np.dot(np.transpose(Y), Y))*np.transpose(Y)
I get LinAlgError: Singular matrix
Note that this does not seem to be a problem with the original data set $X$
Is this a usual behavior or did I do something wrong?