KPP tugas terakhir

# KPP tugas terakhir - KPP tugas terakhir 1 Membandingkan...

• Essay
• 6

This preview shows pages 1–2. Sign up to view the full content.

KPP tugas terakhir. 1. Membandingkan hasil komputasi example 3322 dan 341 2. Memberi komentar exercise 451 3. Menjelaskan output example 462 Point 1 Kode untuk memproyeksikan nilai X1 menggunakan fungsi PCA % 1(a). To generate the data set X1 and a vector y1, whose i-th coordinate % contains the class label of the i-th vector of X1, type randn( 'seed' ,0) S=[.3 1.5; 1.5 9]; [l,l]=size(S); mv=[-8 8; 8 8]'; N=200; X1=[mvnrnd(mv(:,1),S,N); mvnrnd(mv(:,2),S,N)]'; y1=[ones(1,N), 2*ones(1,N)]; % 1(b). To compute the eigenvalues/eigenvectors and variance percentages required in this step type m=2; [eigenval,eigenvec,explained,Y,mean_vec]=pca_fun(X1,m); % 1(c). The projections of the data points of X1 along the direction of the first % principal component are contained in the first row of Y , returned by the % function pca_fun above. % Plot X1 figure(1), hold on figure(1), plot(X1(1,y1==1),X1(2,y1==1), 'r.' ,X1(1,y1==2),X1(2,y1==2), 'bo' ) % Compute the projections of X1 w=eigenvec(:,1); t1=w'*X1(:,y1==1); t2=w'*X1(:,y1==2); X_proj1=[t1;t1].*((w/(w'*w))*ones(1,length(t1))); X_proj2=[t2;t2].*((w/(w'*w))*ones(1,length(t2))); % Plot the projections figure(1),

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern