Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import numpy as np
  2.  
  3. def least_square_estimator(X, Y):
  4. """
  5. Compute beta (minimum cost computation)
  6. --------------------------
  7. (((X^T)X)^-1)((X^T)Y)
  8.  
  9. Order
  10. --------------------------
  11.  
  12. First = (((X^T)X)^-1)
  13. Second = ((X^T)Y)
  14. Final = (((X^T)X)^-1)((X^T)Y)
  15.  
  16. Type
  17. --------------------------
  18. X : ndarray, shape(m_number, n_features)
  19.  
  20. Y : ndarray, shape(m_number, )
  21. """
  22. return np.dot(np.linalg.inv(np.dot(X.T, X)), np.dot(X.T, Y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement