LR.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:MachineLearningProjects 作者: geallen 项目源码 文件源码
def computeCost(X, y, theta):
    '''YOUR CODE HERE'''
    m = float(len(X))

    d = 0
    for i in range(len(X)):
        h = np.dot(theta.transpose(), X[i])
        c = (h - y[i])

        c = (c **2)
        d = (d + c)
    j = (1.0 / (2 * m)) * d
    return j


# Part 5: Prepare the data so that the input X has two columns: first a column of ones to accomodate theta0 and then a column of city population data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号