Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 2/Octave Tutorial/5. Control & Methods/control_methods.txt
625 views
1
GNU Octave, version 4.4.1
2
Copyright (C) 2018 John W. Eaton and others.
3
This is free software; see the source code for copying conditions.
4
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
5
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
6
7
Octave was configured for "x86_64-w64-mingw32".
8
9
Additional information about Octave is available at https://www.octave.org.
10
11
Please contribute if you find this software useful.
12
For more information, visit https://www.octave.org/get-involved.html
13
14
Read https://www.octave.org/bugs.html to learn how to submit bug reports.
15
For information about changes from previous versions, type 'news'.
16
17
octave:1> pwd
18
ans = C:\Users\amlan
19
octave:2> cd 'C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\5. Control & Metho
20
ds'
21
octave:3> squareThosNumber(5)
22
error: 'squareThosNumber' undefined near line 1 column 1
23
octave:3> squareThisNumber(5)
24
ans = 25
25
octave:4> X = [1 1;1 2;1 3]
26
X =
27
28
1 1
29
1 2
30
1 3
31
32
octave:5> y =[1; 2; 3]
33
y =
34
35
1
36
2
37
3
38
39
octave:6> theta =[0;1];
40
octave:7> theta
41
theta =
42
43
0
44
1
45
46
octave:8> j = costFunction(X, y, theta);
47
1
48
2
49
3
50
octave:9> j
51
j = 0
52
octave:10> j = costFunction(X, y, theta);
53
1
54
2
55
3
56
octave:11> j = costFunction(X, y, theta)
57
1
58
2
59
3
60
j = 0
61
octave:12> X * theta
62
ans =
63
64
1
65
2
66
3
67
68
octave:13> X
69
X =
70
71
1 1
72
1 2
73
1 3
74
75
octave:14> theta = [0;0]
76
theta =
77
78
0
79
0
80
81
octave:15> j = costFunction(X, y, theta)
82
0
83
0
84
0
85
j = 21
86
octave:16> X * theta
87
ans =
88
89
0
90
0
91
0
92
93
octave:17> j = costFunction(X, y, theta)
94
0
95
0
96
0
97
j = 21
98
octave:18> y
99
y =
100
101
1
102
2
103
3
104
105
octave:19> theta
106
theta =
107
108
0
109
0
110
111
octave:20> j = costFunction(X, y, theta)
112
0
113
0
114
0
115
j = 21
116
octave:21> j = costFunction(X, y, theta)
117
0
118
0
119
0
120
j = 21
121
octave:22> j = costFunction(X, y, theta)
122
0
123
0
124
0
125
j = 21
126
octave:23> j = costFunction(X, y, theta)
127
0
128
0
129
0
130
j = 21
131
octave:24> j = costFunction(X, y, theta)
132
No. of training examples
133
3
134
No. of predictions
135
0
136
0
137
0
138
Squared Errors
139
sqrErrors
140
j = 21
141
octave:25> j = costFunction(X, y, theta)
142
No. of training examples
143
3
144
No. of predictions
145
0
146
0
147
0
148
Squared Errors
149
1
150
4
151
9
152
j = 21
153
octave:26> j = costFunction(X, y, theta)
154
parse error near line 16 of file C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\5. Control & Methods\costFunction.m
155
156
syntax error
157
158
>>> disp(sum(sqrErrors);
159
^
160
161
octave:26> j = costFunction(X, y, theta)
162
parse error near line 16 of file C:\Users\amlan\Documents\Git Repos\Machine Learning\Coursera_ML_Andrew\Octave Tutorial\5. Control & Methods\costFunction.m
163
164
syntax error
165
166
>>> disp(sum(sqrErrors);
167
^
168
169
octave:26> j = costFunction(X, y, theta)
170
No. of training examples
171
3
172
No. of predictions
173
0
174
0
175
0
176
Squared Errors
177
1
178
4
179
9
180
j = 2.3333
181
octave:27>
182