Skip to content

Commit 830170d

Browse files
Mark LindermanMark Linderman
Mark Linderman
authored and
Mark Linderman
committed
week 8 done
1 parent edfc473 commit 830170d

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

machine-learning-ex7/ex7/ex7_pca.m

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@
144144
% If you are applying a machine learning algorithm
145145
fprintf('\nDimension reduction for face dataset.\n\n');
146146

147+
fprintf('\nSize of X_norm before projection onto Z: ')
148+
fprintf('%d ', size(X_norm));
147149
K = 100;
148150
Z = projectData(X_norm, U, K);
149151

machine-learning-ex7/ex7/projectData.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
% projection_k = x' * U(:, k);
1919
%
2020

21-
Z = X * U(:, K);
21+
% result should be 5000 x 100 for the faces dataset because we're projecting down to 100 features from 1024
22+
% because X is 5000 x 1024 and U is 1024 x 1024 (remember, U was calculated by multiplying X by transpose(X)
2223

24+
Z = X * U(:, 1:K);
2325

2426
% =============================================================
2527

machine-learning-ex7/ex7/recoverData.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
% Notice that U(j, 1:K) is a row vector.
2222
%
2323

24-
X_rec = Z * transpose(U(:, K));
24+
25+
X_rec = Z * transpose(U(:,1:K));
2526

2627
% =============================================================
2728

machine-learning-ex7/ex7/token.mat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Created by Octave 4.4.1, Sun Feb 17 21:26:38 2019 EST <[email protected]>
1+
# Created by Octave 4.4.1, Sat Feb 23 17:12:59 2019 EST <[email protected]>
22
# name: email
33
# type: sq_string
44
# elements: 1

0 commit comments

Comments
 (0)