-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetmyps.m
More file actions
181 lines (143 loc) · 6.06 KB
/
setmyps.m
File metadata and controls
181 lines (143 loc) · 6.06 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
function ps = setmyps(dirName, T,M, ktChs, eRuns, wishRun)
%SETMYPS set my parameters for running charles' model on our code
global nautyInstalled;
if nargin == 0
dirName = '/data/';
end
if nargin <= 1
T = 1;
end
if nargin <= 2
M = 100;
end
ps.structures = {'partition', 'chain', 'order', 'ring', 'hierarchy',...
'tree', 'grid', 'cylinder',...
'partitionnoself',...
'dirchain', 'dirchainnoself', 'undirchain', 'undirchainnoself',...
'ordernoself', 'connected', 'connectednoself',...
'dirring', 'dirringnoself', 'undirring', 'undirringnoself',...
'dirhierarchy', 'dirhierarchynoself', 'undirhierarchy', 'undirhierarchynoself',...
};
% J = 1;
J = sum(ktChs)+length(eRuns)+wishRun;
b = [pwd, dirName];
ps.data = cell(T*J,1);
ps.dlocs = cell(T*J,1);
for t = 1:T
curIt = 1;
if ktChs(1)
ps.data{(t-1)*J+curIt} = [genRandPartSig(-1) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandPartSig(-1) num2str(t)];
curIt = curIt+1;
end
if ktChs(2)
ps.data{(t-1)*J+curIt} = [genRandChainSig(-1) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandChainSig(-1) num2str(t)];
curIt = curIt+1;
end
if ktChs(3)
ps.data{(t-1)*J+curIt} = [genRandTreeSig(-1) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandTreeSig(-1) num2str(t)];
curIt = curIt+1;
end
if ktChs(4)
ps.data{(t-1)*J+curIt} = [genRandGridSig(-1) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandGridSig(-1) num2str(t)];
curIt = curIt+1;
end
for jEps = 1:length(eRuns)
ps.data{(t-1)*J+curIt} = [genRandErdosSig(-1,eRuns(jEps)) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandErdosSig(-1,eRuns(jEps)) num2str(t)];
curIt = curIt+1;
end
if wishRun
ps.data{(t-1)*J+curIt} = [genRandWishSig(-1) num2str(t)];
ps.dlocs{(t-1)*J+curIt} = [b genRandWishSig(-1) num2str(t)];
end
end
%effective number of features for XX data
ps.repeats = ones(1,length(ps.data));
ps.simdim = {};
for i=1:length(ps.data)
ps.simdim{i} = M;
end
%% HYPERPARAMETERS
ps.lbeta = 0.4; % parameter for exponential prior on branch-lengths
% lbeta is expected branch length
ps.sigbeta = 0.4; % parameter for exponential prior on 1/sigma
% sigbeta is expected value of 1/sigma
ps.sigmainit = (1/ps.sigbeta); % initial value for regularization parameter
ps.theta = (1-exp(-3)); % each additional node reduces prior by 3
% DATA -- which (if any) pre-processing steps to apply
% Feature data: simpleshiftscale -- make data zero mean, ensure that max
% entry in the covariance matrix is 1
% makesimlike -- transform data so that the largest
% entry in the covariance matrix is 1, and the
% smallest entry is 0
% none -- no pre-processing
% Similarity data: center -- center the similarity matrix
% none -- no pre-processing
ps.datatransform = 'none'; % none, makesimlike, simpleshiftscale
ps.simtransform = 'none'; % none, center
%% DISPLAY
ps.showtruegraph = 0; % show true graph. For artificial data only
ps.showinferredgraph = 0; % show inferred graph
ps.showbestsplit = 0; % picture each time a node is split
ps.showpreclean = 0; % show best graph (pre cleaning) at each depth
ps.showpostclean = 0; % show best graph (post cleaning) at each depth
% SPEED
% Optimizing the branch lengths is slow, and these options specify when
% this step will take place.
% 1: optimize branch lengths everywhere
% 2: optimize branch lengths once a node has been fully split
% 23: start out at 3 and finish at 2
% 3: only optimize branch lengths once the best split has been chosen
% 4: only optimize branch lengths once per depth
% 5: maximize approximate score (only optimize branch lengths as a heuristic if
% search is otherwise finished)
% 54: speed 5 then 4
ps.speed = 54;
% CONSTRAINTS ON THE BRANCH LENGTHS
% external branches join entities to clusters.
% internal branches join clusters to clusters
ps.fixedall = 0; % all branch lengths must be identical
ps.fixedinternal = 0; % internal branch lengths must be identical
ps.fixedexternal = 0; % external branch lengths must be identical
ps.prodtied = 0; % each branch length in a "direct product"
% graph (e.g. a grid) must equal the
% corresponding branch length from the
% corresponding component graph.
% Search strategies:
% intext -- start with ps.fixedinternal = 1, ps.fixedexternal = 1
% then just ps.fixedexternal = 1.
% then remove all branch length constraints.
ps.init = 'intext'; % none, ext, int, intext, fixedall
% OTHER
ps.gibbsclean = 1 ; % use heuristics to improve graph after each split
ps.nauty= nautyInstalled; % is nauty installed? If so we'll save some
% time by only considering near misses up to
% isomorphism. Results in the PNAS paper
% were generated with this set to 1. It's not
% set to 0 for users who don't have nauty
% installed --- this might slow down the code
% but shouldn't change the results.
ps.outsideinit = ''; % initialize with outside graph
ps.zglreg = 1; % regularize like Zhu, Ghahramani and Lafferty
% suggest (add terms along the entire
% diagonal of the precision matrix
ps.featforce = 0; % a square matrix is treated by default as a
% similarity matrix. Set this flag to
% analyze a square feature matrix.
% We integrate out the parameters of the relational model. The next three
% parameters set up the parameter grid we consider.
ps.edgesumsteps = 10; % number of magnitudes
ps.edgesumlambda = 2; % base of magnitudes
ps.edgeoffset =-5; % first magnitude is base^offset
% initializing a relational structure:
% none: initialize with all objects in one cluster.
% overd: use a structure created with one object per cluster
% external: use a structure from ps.relinitdir
ps.reloutsideinit='none';
% Add path to appropriate directory if ps.reloutsideinit = 'external'
ps.relinitdir= '';
end