|
20 | 20 | # self.files[i].write(param+"\n")
|
21 | 21 |
|
22 | 22 | class ParamsWriter:
|
23 |
| - def __init__(self, name, num_params): |
| 23 | + def __init__(self, name, param_names): |
24 | 24 | self.file = codecs.open("substitution_parameters/"+name+"_param.txt", "w",encoding="utf-8")
|
25 |
| - for i in range(0,num_params): |
| 25 | + for i in range(0,len(param_names)): |
26 | 26 | if i>0:
|
27 | 27 | self.file.write("|")
|
28 |
| - self.file.write("Param"+str(i)) |
| 28 | + self.file.write(param_names[i]) |
29 | 29 | self.file.write("\n")
|
30 | 30 |
|
31 | 31 | def append(self, params, counts):
|
@@ -114,126 +114,126 @@ def key_params(sample, lower_bound, upper_bound):
|
114 | 114 | return results
|
115 | 115 |
|
116 | 116 | def serialize_q1(post_weeks):
|
117 |
| - writer = ParamsWriter("q1", 1) |
| 117 | + writer = ParamsWriter("q1", ["date"]) |
118 | 118 | for week, count in post_weeks:
|
119 | 119 | writer.append([str(week)], [count])
|
120 | 120 |
|
121 | 121 | def serialize_q2(country_sets, post_day_ranges):
|
122 |
| - writer = ParamsWriter("q2", 3) |
| 122 | + writer = ParamsWriter("q2", ["date1","date2","countries","endDate"]) |
123 | 123 | random.seed(1988+2)
|
124 | 124 | for country_set, count_country in country_sets:
|
125 | 125 | for day_range, count_post in post_day_ranges:
|
126 | 126 | if random.randint(0,len(country_sets) + len(post_day_ranges)) == 0:
|
127 |
| - writer.append([str(day_range[0]), str(day_range[1]), ",".join(country_set)], [count_post,count_post,count_country]) |
| 127 | + writer.append([str(day_range[0]), str(day_range[1]), "2013-01-01", ",".join(country_set)], [count_post,count_post,count_country,333]) |
128 | 128 |
|
129 | 129 | def serialize_q3(post_months):
|
130 |
| - writer = ParamsWriter("q3", 2) |
| 130 | + writer = ParamsWriter("q3", ["todo1","todo2"]) |
131 | 131 | for ix in range(0,len(post_months)):
|
132 | 132 | week_range_a, count_a = post_months[ix]
|
133 | 133 | for week_range_b, count_b in post_months[ix+1:]:
|
134 | 134 | writer.append([str(week_range_a),str(week_range_b)], [count_a,count_b])
|
135 | 135 |
|
136 | 136 | def serialize_q4(tagclasses, countries):
|
137 |
| - writer = ParamsWriter("q4", 2) |
| 137 | + writer = ParamsWriter("q4", ["tagClass","country"]) |
138 | 138 | for tag, count_a in tagclasses:
|
139 | 139 | for country, count_b in countries:
|
140 | 140 | writer.append([tag,country], [count_a,count_b])
|
141 | 141 |
|
142 | 142 | def serialize_q5(countries):
|
143 |
| - writer = ParamsWriter("q5", 1) |
| 143 | + writer = ParamsWriter("q5", ["country"]) |
144 | 144 | for country, count in countries:
|
145 | 145 | writer.append([country], [count])
|
146 | 146 |
|
147 | 147 |
|
148 | 148 | def serialize_q6(tags):
|
149 |
| - writer = ParamsWriter("q6", 1) |
| 149 | + writer = ParamsWriter("q6", ["tag"]) |
150 | 150 | for tag, count in tags:
|
151 | 151 | writer.append([tag], [count])
|
152 | 152 |
|
153 | 153 | def serialize_q7(tags):
|
154 |
| - writer = ParamsWriter("q7", 1) |
| 154 | + writer = ParamsWriter("q7", ["tag"]) |
155 | 155 | for tag, count in tags:
|
156 | 156 | writer.append([tag], [count])
|
157 | 157 |
|
158 | 158 | def serialize_q8(tags):
|
159 |
| - writer = ParamsWriter("q8", 1) |
| 159 | + writer = ParamsWriter("q8", ["tag"]) |
160 | 160 | for tag, count in tags:
|
161 | 161 | writer.append([tag], [count])
|
162 | 162 |
|
163 | 163 | def serialize_q9(tagclasses):
|
164 |
| - writer = ParamsWriter("q9", 2) |
| 164 | + writer = ParamsWriter("q9", ["tagClass1", "tagClass2", "threshold"]) |
165 | 165 | for ix in range(0,len(tagclasses)):
|
166 | 166 | tag_class_a, count_a = tagclasses[ix]
|
167 | 167 | for tag_class_b, count_b in tagclasses[ix+1:]:
|
168 |
| - writer.append([tag_class_a, tag_class_b], [count_a, count_b]) |
| 168 | + writer.append([tag_class_a, tag_class_b, str(200)], [count_a, count_b]) |
169 | 169 |
|
170 | 170 | def serialize_q10(tags):
|
171 |
| - writer = ParamsWriter("q10", 1) |
| 171 | + writer = ParamsWriter("q10", ["tag"]) |
172 | 172 | for tag, count in tags:
|
173 | 173 | writer.append([tag], [count])
|
174 | 174 |
|
175 | 175 | def serialize_q12(post_weeks):
|
176 |
| - writer = ParamsWriter("q12", 1) |
| 176 | + writer = ParamsWriter("q12", ["creationDate", "likeCount"]) |
177 | 177 | for week, count in post_weeks:
|
178 |
| - writer.append([str(week)], [count]) |
| 178 | + writer.append([str(week),str(400)], [count]) |
179 | 179 |
|
180 | 180 | def serialize_q13(countries):
|
181 |
| - writer = ParamsWriter("q13", 1) |
| 181 | + writer = ParamsWriter("q13", ["country"]) |
182 | 182 | for country, count in countries:
|
183 | 183 | writer.append([country], [count])
|
184 | 184 |
|
185 | 185 | def serialize_q14(creationdates):
|
186 |
| - writer = ParamsWriter("q14", 1) |
| 186 | + writer = ParamsWriter("q14", ["begin","todoEnd"]) |
187 | 187 | for creation, count in creationdates:
|
188 |
| - writer.append([str(creation)], [count]) |
| 188 | + writer.append([str(creation),"todo"], [count]) |
189 | 189 |
|
190 | 190 | def serialize_q15(countries):
|
191 |
| - writer = ParamsWriter("q15", 1) |
| 191 | + writer = ParamsWriter("q15", ["country"]) |
192 | 192 | for country, count in countries:
|
193 | 193 | writer.append([country], [count])
|
194 | 194 |
|
195 | 195 | def serialize_q16(tagclasses, countries):
|
196 |
| - writer = ParamsWriter("q16", 2) |
| 196 | + writer = ParamsWriter("q16", ["todoPerson","tag","country"]) |
197 | 197 | for tag, count_a in tagclasses:
|
198 | 198 | for country, count_b in countries:
|
199 |
| - writer.append([tag, country], [count_a, count_b]) |
| 199 | + writer.append([str(11052), tag, country], [count_a, count_b]) |
200 | 200 |
|
201 | 201 | def serialize_q17(countries):
|
202 |
| - writer = ParamsWriter("q17", 1) |
| 202 | + writer = ParamsWriter("q17", ["country"]) |
203 | 203 | for country, count in countries:
|
204 | 204 | writer.append([country], [count])
|
205 | 205 |
|
206 | 206 | def serialize_q18(post_weeks):
|
207 |
| - writer = ParamsWriter("q18", 1) |
| 207 | + writer = ParamsWriter("q18", ["creationDate"]) |
208 | 208 | for week, count in post_weeks:
|
209 | 209 | writer.append([str(week)], [count])
|
210 | 210 |
|
211 | 211 | def serialize_q19(tagclasses):
|
212 |
| - writer = ParamsWriter("q19", 2) |
| 212 | + writer = ParamsWriter("q19", ["date","tagClass1","tagClass2"]) |
213 | 213 | for ix in range(0,len(tagclasses)):
|
214 | 214 | tag_class_a, count_a = tagclasses[ix]
|
215 | 215 | for tag_class_b, count_b in tagclasses[ix+1:]:
|
216 |
| - writer.append([tag_class_a, tag_class_b], [count_a, count_b]) |
| 216 | + writer.append([str("1989-1-1"),tag_class_a, tag_class_b], [count_a, count_b]) |
217 | 217 |
|
218 | 218 | def serialize_q21(countries):
|
219 |
| - writer = ParamsWriter("q21", 1) |
| 219 | + writer = ParamsWriter("q21", ["country","endDate"]) |
220 | 220 | for country, count in countries:
|
221 |
| - writer.append([country], [count]) |
| 221 | + writer.append([country,str("2013-02-01")], [count]) |
222 | 222 |
|
223 | 223 | def serialize_q22(countries):
|
224 |
| - writer = ParamsWriter("q22", 2) |
| 224 | + writer = ParamsWriter("q22", ["country1","country2"]) |
225 | 225 | for ix in range(0,len(countries)):
|
226 | 226 | country_a, count_a = countries[ix]
|
227 | 227 | for country_b, count_b in countries[ix+1:]:
|
228 | 228 | writer.append([country_a, country_b], [count_a, count_b])
|
229 | 229 |
|
230 | 230 | def serialize_q23(countries):
|
231 |
| - writer = ParamsWriter("q23", 1) |
| 231 | + writer = ParamsWriter("q23", ["country"]) |
232 | 232 | for country, count in countries:
|
233 | 233 | writer.append([country], [count])
|
234 | 234 |
|
235 | 235 | def serialize_q24(tagclasses):
|
236 |
| - writer = ParamsWriter("q24", 1) |
| 236 | + writer = ParamsWriter("q24", ["tagClass"]) |
237 | 237 | for tagclass, count in tagclasses:
|
238 | 238 | writer.append([tagclass], [count])
|
239 | 239 |
|
|
0 commit comments