Skip to content

Commit 789acf4

Browse files
committed
2 parents 78ce87d + 2aa6059 commit 789acf4

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

paramgenerator/generateparamsbi.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
# self.files[i].write(param+"\n")
2121

2222
class ParamsWriter:
23-
def __init__(self, name, num_params):
23+
def __init__(self, name, param_names):
2424
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)):
2626
if i>0:
2727
self.file.write("|")
28-
self.file.write("Param"+str(i))
28+
self.file.write(param_names[i])
2929
self.file.write("\n")
3030

3131
def append(self, params, counts):
@@ -114,126 +114,126 @@ def key_params(sample, lower_bound, upper_bound):
114114
return results
115115

116116
def serialize_q1(post_weeks):
117-
writer = ParamsWriter("q1", 1)
117+
writer = ParamsWriter("q1", ["date"])
118118
for week, count in post_weeks:
119119
writer.append([str(week)], [count])
120120

121121
def serialize_q2(country_sets, post_day_ranges):
122-
writer = ParamsWriter("q2", 3)
122+
writer = ParamsWriter("q2", ["date1","date2","countries","endDate"])
123123
random.seed(1988+2)
124124
for country_set, count_country in country_sets:
125125
for day_range, count_post in post_day_ranges:
126126
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])
128128

129129
def serialize_q3(post_months):
130-
writer = ParamsWriter("q3", 2)
130+
writer = ParamsWriter("q3", ["todo1","todo2"])
131131
for ix in range(0,len(post_months)):
132132
week_range_a, count_a = post_months[ix]
133133
for week_range_b, count_b in post_months[ix+1:]:
134134
writer.append([str(week_range_a),str(week_range_b)], [count_a,count_b])
135135

136136
def serialize_q4(tagclasses, countries):
137-
writer = ParamsWriter("q4", 2)
137+
writer = ParamsWriter("q4", ["tagClass","country"])
138138
for tag, count_a in tagclasses:
139139
for country, count_b in countries:
140140
writer.append([tag,country], [count_a,count_b])
141141

142142
def serialize_q5(countries):
143-
writer = ParamsWriter("q5", 1)
143+
writer = ParamsWriter("q5", ["country"])
144144
for country, count in countries:
145145
writer.append([country], [count])
146146

147147

148148
def serialize_q6(tags):
149-
writer = ParamsWriter("q6", 1)
149+
writer = ParamsWriter("q6", ["tag"])
150150
for tag, count in tags:
151151
writer.append([tag], [count])
152152

153153
def serialize_q7(tags):
154-
writer = ParamsWriter("q7", 1)
154+
writer = ParamsWriter("q7", ["tag"])
155155
for tag, count in tags:
156156
writer.append([tag], [count])
157157

158158
def serialize_q8(tags):
159-
writer = ParamsWriter("q8", 1)
159+
writer = ParamsWriter("q8", ["tag"])
160160
for tag, count in tags:
161161
writer.append([tag], [count])
162162

163163
def serialize_q9(tagclasses):
164-
writer = ParamsWriter("q9", 2)
164+
writer = ParamsWriter("q9", ["tagClass1", "tagClass2", "threshold"])
165165
for ix in range(0,len(tagclasses)):
166166
tag_class_a, count_a = tagclasses[ix]
167167
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])
169169

170170
def serialize_q10(tags):
171-
writer = ParamsWriter("q10", 1)
171+
writer = ParamsWriter("q10", ["tag"])
172172
for tag, count in tags:
173173
writer.append([tag], [count])
174174

175175
def serialize_q12(post_weeks):
176-
writer = ParamsWriter("q12", 1)
176+
writer = ParamsWriter("q12", ["creationDate", "likeCount"])
177177
for week, count in post_weeks:
178-
writer.append([str(week)], [count])
178+
writer.append([str(week),str(400)], [count])
179179

180180
def serialize_q13(countries):
181-
writer = ParamsWriter("q13", 1)
181+
writer = ParamsWriter("q13", ["country"])
182182
for country, count in countries:
183183
writer.append([country], [count])
184184

185185
def serialize_q14(creationdates):
186-
writer = ParamsWriter("q14", 1)
186+
writer = ParamsWriter("q14", ["begin","todoEnd"])
187187
for creation, count in creationdates:
188-
writer.append([str(creation)], [count])
188+
writer.append([str(creation),"todo"], [count])
189189

190190
def serialize_q15(countries):
191-
writer = ParamsWriter("q15", 1)
191+
writer = ParamsWriter("q15", ["country"])
192192
for country, count in countries:
193193
writer.append([country], [count])
194194

195195
def serialize_q16(tagclasses, countries):
196-
writer = ParamsWriter("q16", 2)
196+
writer = ParamsWriter("q16", ["todoPerson","tag","country"])
197197
for tag, count_a in tagclasses:
198198
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])
200200

201201
def serialize_q17(countries):
202-
writer = ParamsWriter("q17", 1)
202+
writer = ParamsWriter("q17", ["country"])
203203
for country, count in countries:
204204
writer.append([country], [count])
205205

206206
def serialize_q18(post_weeks):
207-
writer = ParamsWriter("q18", 1)
207+
writer = ParamsWriter("q18", ["creationDate"])
208208
for week, count in post_weeks:
209209
writer.append([str(week)], [count])
210210

211211
def serialize_q19(tagclasses):
212-
writer = ParamsWriter("q19", 2)
212+
writer = ParamsWriter("q19", ["date","tagClass1","tagClass2"])
213213
for ix in range(0,len(tagclasses)):
214214
tag_class_a, count_a = tagclasses[ix]
215215
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])
217217

218218
def serialize_q21(countries):
219-
writer = ParamsWriter("q21", 1)
219+
writer = ParamsWriter("q21", ["country","endDate"])
220220
for country, count in countries:
221-
writer.append([country], [count])
221+
writer.append([country,str("2013-02-01")], [count])
222222

223223
def serialize_q22(countries):
224-
writer = ParamsWriter("q22", 2)
224+
writer = ParamsWriter("q22", ["country1","country2"])
225225
for ix in range(0,len(countries)):
226226
country_a, count_a = countries[ix]
227227
for country_b, count_b in countries[ix+1:]:
228228
writer.append([country_a, country_b], [count_a, count_b])
229229

230230
def serialize_q23(countries):
231-
writer = ParamsWriter("q23", 1)
231+
writer = ParamsWriter("q23", ["country"])
232232
for country, count in countries:
233233
writer.append([country], [count])
234234

235235
def serialize_q24(tagclasses):
236-
writer = ParamsWriter("q24", 1)
236+
writer = ParamsWriter("q24", ["tagClass"])
237237
for tagclass, count in tagclasses:
238238
writer.append([tagclass], [count])
239239

0 commit comments

Comments
 (0)