-
Notifications
You must be signed in to change notification settings - Fork 2
/
FEethno.m
60 lines (33 loc) · 1.33 KB
/
FEethno.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
dirName ='C:\Users\Julius Gruber\Dropbox\Master\matlab\Datenbank\ethno';
fileInformationArray = getAllFileNames(dirName);
nxd = [];
for k =1: length(fileInformationArray)
currentFilePath = fileInformationArray{k,1};
indexOfSlashes = strfind(currentFilePath, '\');
indexOfLastSlash = indexOfSlashes(end);
indexOfFolderSlash = indexOfSlashes(end -1);
currentFileName = currentFilePath(indexOfLastSlash+1 : end);
fileInformationArray{k,2} = currentFileName;
currentClassName = currentFilePath(indexOfFolderSlash+1 : indexOfLastSlash-1);
fileInformationArray{k,3} = currentClassName;
fileInformationArray{k,4} = 0;%fake class number, there are no classes for this folder
end
% nxd = calculateMirFeatures2(fileInformationArray);
nxdStruct = load('ethnoFeatures.mat');
nxd = nxdStruct.nxd;
names = char(fileInformationArray{:,3});
myColorMap = [1 0 0
0 1 0
0 0 1];
% set Paramters
no_dims = 2;
initial_dims = 15;
perplexity = 7;
% run t-SNE
mappedX = tsne(nxd, [], no_dims, initial_dims, perplexity);
% Plot reults
figure();
gscatter(mappedX(:,1), mappedX(:,2), names, myColorMap);
figure();
gscatter(mappedX(:,1), mappedX(:,2));
viewPortTransformAndCreateTXTfile(mappedX, fileInformationArray);