Machine Learning 第一波编程作业

仅列出核心代码:

1.computeCost

J  = sum((X*theta-y).^2)/(2*m);

2.gradientDescent

theta = theta - (1/m)*alpha*(X.'*(X*theta-y));

3.featureNormalize

mu = mean(X);
sigma = std(X);
X_norm = (X - ones(size(X, 1), 1) * mu) ./ (ones(size(X, 1), 1) * sigma);

4.computeCostMulti

J = (X * theta - y).' * (X * theta - y) / (2*m);

5.gradientDescentMulti

theta = theta - (1/m)*alpha*(X.'*(X*theta-y));

6.normalEqn

theta = inv(X.' * X) * X.' * y;

课程地址:https://www.coursera.org/course/ml

 

posted on 2013-05-09 23:37  Andnot  阅读(729)  评论(0编辑  收藏  举报

导航