Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grandient函数定义疑问 #57

Open
gttiankai opened this issue Oct 14, 2019 · 0 comments
Open

grandient函数定义疑问 #57

gttiankai opened this issue Oct 14, 2019 · 0 comments

Comments

@gttiankai
Copy link

在 code 的1.linear_regreesion_v1.ipynb文件中, 关于 grandient 函数的定义不明白?

def gradient(theta, X, y):
    m = X.shape[0]

    inner = X.T @ (X @ theta - y)  # (m,n).T @ (m, 1) -> (n, 1),X @ theta等价于X.dot(theta)

    return inner / m

为什么是 inner = X.T @ (X @ theta - y)?
我看方程的定义是:
image

为啥不是 inner = (theta.T @ X -y) @ X ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant