Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 2/Programming Assignment-1/submit.m
626 views
1
function submit()
2
addpath('./lib');
3
4
conf.assignmentSlug = 'linear-regression';
5
conf.itemName = 'Linear Regression with Multiple Variables';
6
conf.partArrays = { ...
7
{ ...
8
'1', ...
9
{ 'warmUpExercise.m' }, ...
10
'Warm-up Exercise', ...
11
}, ...
12
{ ...
13
'2', ...
14
{ 'computeCost.m' }, ...
15
'Computing Cost (for One Variable)', ...
16
}, ...
17
{ ...
18
'3', ...
19
{ 'gradientDescent.m' }, ...
20
'Gradient Descent (for One Variable)', ...
21
}, ...
22
{ ...
23
'4', ...
24
{ 'featureNormalize.m' }, ...
25
'Feature Normalization', ...
26
}, ...
27
{ ...
28
'5', ...
29
{ 'computeCostMulti.m' }, ...
30
'Computing Cost (for Multiple Variables)', ...
31
}, ...
32
{ ...
33
'6', ...
34
{ 'gradientDescentMulti.m' }, ...
35
'Gradient Descent (for Multiple Variables)', ...
36
}, ...
37
{ ...
38
'7', ...
39
{ 'normalEqn.m' }, ...
40
'Normal Equations', ...
41
}, ...
42
};
43
conf.output = @output;
44
45
submitWithConfiguration(conf);
46
end
47
48
function out = output(partId)
49
% Random Test Cases
50
X1 = [ones(20,1) (exp(1) + exp(2) * (0.1:0.1:2))'];
51
Y1 = X1(:,2) + sin(X1(:,1)) + cos(X1(:,2));
52
X2 = [X1 X1(:,2).^0.5 X1(:,2).^0.25];
53
Y2 = Y1.^0.5 + Y1;
54
if partId == '1'
55
out = sprintf('%0.5f ', warmUpExercise());
56
elseif partId == '2'
57
out = sprintf('%0.5f ', computeCost(X1, Y1, [0.5 -0.5]'));
58
elseif partId == '3'
59
out = sprintf('%0.5f ', gradientDescent(X1, Y1, [0.5 -0.5]', 0.01, 10));
60
elseif partId == '4'
61
out = sprintf('%0.5f ', featureNormalize(X2(:,2:4)));
62
elseif partId == '5'
63
out = sprintf('%0.5f ', computeCostMulti(X2, Y2, [0.1 0.2 0.3 0.4]'));
64
elseif partId == '6'
65
out = sprintf('%0.5f ', gradientDescentMulti(X2, Y2, [-0.1 -0.2 -0.3 -0.4]', 0.01, 10));
66
elseif partId == '7'
67
out = sprintf('%0.5f ', normalEqn(X2, Y2));
68
end
69
end
70
71