-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.m
35 lines (21 loc) · 985 Bytes
/
Main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
%---------------------------------------------------------------------%
% Dimensionality Reduction source codes demo version %
%---------------------------------------------------------------------%
%---Input--------------------------------------------------------------
% feat : feature vector (instances x features)
% num_pc : number of principal components
%---Output-------------------------------------------------------------
% new_feat : New features (instances x features)
%----------------------------------------------------------------------
%% Principle Component Analysis
clc, clear, close
% Benchmark data set
load iris.mat
% Set number of principal compoments
num_pc = 3;
% Principal Component Analysis
new_feat = jpca(feat,num_pc);
% Plot first three principal components
jplot(new_feat,label);
legend({'setosa','versicolor','virginica'});
xlabel('PC 1'); ylabel('PC 2'); zlabel('PC 3');