To find the pseudo inverse of the design matrix, you can compute the QR decomposition and then easily compute the inverses of the resulting Q and R matrices, and then matrix-multiply those inverses.
Dr. James McCaffrey presents a complete end-to-end demonstration of linear regression using pseudo-inverse training. Compared to other training techniques, such as stochastic gradient descent, ...