资源简介

coursera吴恩达机器学习第一到第六周octave编程作业

资源截图

代码片段和文件信息

function J = computeCost(X y theta)
%COMPUTECOST Compute cost for linear regression
%   J = COMPUTECOST(X y theta) computes the cost of using theta as the
%   parameter for linear regression to fit the data points in X and y

% Initialize some useful values
m = length(y); % number of training examples

% You need to return the following variables correctly 
J = 0;

% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
%               You should set J to the cost.

predictions = X*theta;  %X:m*2-d ; theta:2*1-d
sqrErrors = (predictions-y) .^2;
J = 1/(2*m) * sum(sqrErrors);


% =========================================================================

end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件      489928  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1.pdf
     目录           0  2017-12-05 14:23  machine-learning-ex1-linear regression\ex1\
     文件         740  2017-12-05 10:10  machine-learning-ex1-linear regression\ex1\computeCost.m
     文件         780  2017-12-05 14:09  machine-learning-ex1-linear regression\ex1\computeCostMulti.m
     文件        3908  2017-03-20 13:50  machine-learning-ex1-linear regression\ex1\ex1.m
     文件        4507  2017-12-05 15:32  machine-learning-ex1-linear regression\ex1\ex1_multi.m
     文件        1359  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\ex1data1.txt
     文件         657  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\ex1data2.txt
     文件        1365  2017-12-05 14:58  machine-learning-ex1-linear regression\ex1\featureNormalize.m
     文件         957  2017-12-05 10:48  machine-learning-ex1-linear regression\ex1\gradientDescent.m
     文件         981  2017-12-05 14:11  machine-learning-ex1-linear regression\ex1\gradientDescentMulti.m
     目录           0  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\
     目录           0  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\
     文件        1624  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\AUTHORS.txt
     文件        3862  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\ChangeLog.txt
     文件         881  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\jsonopt.m
     文件        1551  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\LICENSE_BSD.txt
     文件       18732  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\loadjson.m
     文件       15574  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\loadubjson.m
     文件         771  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\mergestruct.m
     文件       19369  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\README.txt
     文件       17462  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\savejson.m
     文件       16123  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\saveubjson.m
     文件        1094  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\jsonlab\varargin2struct.m
     文件        1195  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\makeValidFieldName.m
     文件        5562  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\lib\submitWithConfiguration.m
     文件         669  2017-12-05 15:31  machine-learning-ex1-linear regression\ex1\normalEqn.m
     文件        6293  2017-12-05 14:23  machine-learning-ex1-linear regression\ex1\octave-workspace
     文件         982  2017-12-05 09:31  machine-learning-ex1-linear regression\ex1\plotData.m
     文件        1876  2017-03-14 09:40  machine-learning-ex1-linear regression\ex1\submit.m
     文件        3098  2017-12-06 14:37  machine-learning-ex1-linear regression\ex1\test.m
............此处省略176个文件信息

评论

共有 条评论