DisTools introductory 2D example
Get rid of old figures, generate a trainset and a testset and give them proper names
delfigs
AT = setname(gendatb,'TrainSet')
AS = setname(gendatb,'TestSet')
The following statements just show how in PRTools a 2D space can be mapped onto a 6D polynomial space in which every direction corresponds to an original feature raised to some power, here for degrees 1, 2 and 3.
XP = AT*cmapm(2,[1 0; 0 1; 2 0; 0 2; 3 0; 0 3;]);
+XP(1:5,:) % show result for first 5 objects
The next statements show how a a mapping VM
to a Minkowsky-2 (i.e. Euclidean) set dissimilarities is defined using all training objects AT
for representation. After that the training set is mapped into that space, constructing thereby square dissimilarity matrix XM
.
VM = AT*proxm([],'m',2); % the dissimilarity mapping
XM = AT*VM % map the training set
+XM(1:5,1:5) % show the first 5 dissimilarities of 5 objects
Define a set of untrained classifiers all based on Fisher’s Linear Discriminant: in the original 2D feature space, in the 6D polynomial space, in the 100D dissimilarity space and in a 10D PCA projection of the last one. Give them proper names and train them by AT
.
U1 = fisherc; % Fisher in 2D feature space
U2 = cmapm(2,[1 0; 0 1; 2 0; 0 2; 3 0; 0 3;])*fisherc;
U2 = setname(
U2
,'PolyFisher'); % Fisher in polynomial space
U3 = proxm([],'m',2)*fisherc;
U3
= setname(U3
,'DisSpaceFisher'); % Fisher in disspace
U4 = proxm([],'m',2)*pca([],10)*fisherc;
U4
= setname(U4
,'DisSpacePCAFisher'); % Fisher in PCA disspace
W = AT*{U1,U2,U3,U4}; % Train them all
Show results in a scatter plot
scatterd(AT)
plotc(W)
Classify trainset and testset and show results.
testc({AT,AS},W)
Return to DisTools Introductory Examples | Continue with next DisTools Example |