This commit is contained in:
HaoYizhi 2023-05-21 17:05:06 +08:00
parent b4e9512439
commit 475ba35613
12 changed files with 565 additions and 10 deletions

1
.vscode/launch.json vendored
View File

@ -14,6 +14,7 @@
"args": [ "args": [
"--exp", "without_exp", "--exp", "without_exp",
"--job", "24", "--job", "24",
"--reset_db", "True",
] ]
} }
] ]

420
InitRemovalHighRisk.csv Normal file
View File

@ -0,0 +1,420 @@
e_id,count,max_max_ts,dct_lst_init_remove_firm_prod
83,50,3,...
135,50,3,...
138,50,2,...
179,50,3,...
184,50,3,...
190,50,3,...
227,50,2,...
307,50,2,...
358,50,1,...
372,50,1,...
383,50,3,...
405,50,3,...
411,50,2,...
412,50,2,...
445,50,2,...
29,25,1,...
256,24,1,...
257,23,1,...
259,20,1,...
28,19,1,...
30,19,1,...
258,18,1,...
262,18,1,...
260,17,1,...
26,16,1,...
32,16,1,...
27,13,1,...
53,13,1,...
173,13,1,...
400,13,1,...
5,12,1,...
31,12,1,...
89,12,1,...
140,12,1,...
142,12,2,...
234,12,1,...
21,11,1,...
64,11,1,...
244,11,1,...
290,11,1,...
444,11,1,...
65,10,1,...
66,10,1,...
68,10,1,...
92,10,1,...
94,10,1,...
265,10,1,...
335,10,2,...
370,10,1,...
380,10,1,...
388,10,1,...
401,10,1,...
43,9,1,...
45,9,1,...
48,9,1,...
67,9,1,...
90,9,1,...
95,9,1,...
96,9,1,...
143,9,1,...
147,9,1,...
163,9,1,...
165,9,1,...
201,9,1,...
300,9,1,...
306,9,1,...
327,9,1,...
330,9,1,...
381,9,1,...
387,9,1,...
389,9,1,...
8,8,1,...
40,8,1,...
44,8,1,...
46,8,1,...
62,8,1,...
87,8,1,...
91,8,1,...
93,8,1,...
203,8,1,...
210,8,1,...
211,8,1,...
243,8,1,...
313,8,1,...
326,8,1,...
371,8,1,...
382,8,1,...
385,8,1,...
386,8,1,...
391,8,1,...
422,8,1,...
435,8,1,...
6,7,2,...
14,7,1,...
20,7,2,...
47,7,1,...
63,7,1,...
141,7,2,...
154,7,1,...
164,7,1,...
200,7,1,...
204,7,1,...
207,7,1,...
237,7,1,...
246,7,1,...
252,7,1,...
254,7,2,...
261,7,1,...
268,7,1,...
270,7,1,...
286,7,1,...
432,7,1,...
434,7,1,...
436,7,1,...
446,7,1,...
451,7,1,...
4,6,1,...
15,6,1,...
22,6,1,...
25,6,1,...
39,6,1,...
41,6,1,...
42,6,1,...
52,6,1,...
55,6,1,...
56,6,1,...
75,6,1,...
81,6,1,...
82,6,1,...
84,6,1,...
86,6,1,...
113,6,1,...
114,6,1,...
127,6,1,...
139,6,1,...
159,6,1,...
162,6,1,...
233,6,1,...
235,6,1,...
267,6,1,...
292,6,1,...
295,6,1,...
339,6,1,...
349,6,1,...
363,6,1,...
449,6,1,...
460,6,1,...
461,6,1,...
473,6,1,...
474,6,1,...
2,5,1,...
3,5,1,...
7,5,2,...
13,5,1,...
77,5,1,...
101,5,1,...
108,5,1,...
112,5,1,...
123,5,1,...
166,5,1,...
167,5,1,...
202,5,1,...
205,5,1,...
206,5,1,...
215,5,1,...
222,5,1,...
232,5,1,...
238,5,1,...
239,5,1,...
248,5,1,...
253,5,1,...
266,5,1,...
277,5,1,...
331,5,1,...
336,5,1,...
337,5,1,...
348,5,1,...
367,5,1,...
369,5,1,...
376,5,1,...
390,5,1,...
420,5,1,...
423,5,1,...
431,5,1,...
462,5,1,...
465,5,1,...
471,5,1,...
472,5,1,...
16,4,1,...
17,4,1,...
59,4,1,...
60,4,1,...
61,4,1,...
79,4,1,...
85,4,1,...
88,4,1,...
110,4,1,...
126,4,1,...
145,4,1,...
156,4,1,...
169,4,1,...
170,4,1,...
172,4,1,...
219,4,1,...
220,4,1,...
221,4,1,...
224,4,1,...
228,4,1,...
229,4,1,...
245,4,1,...
249,4,1,...
251,4,1,...
287,4,1,...
291,4,1,...
293,4,1,...
305,4,1,...
328,4,1,...
329,4,1,...
338,4,1,...
352,4,1,...
366,4,1,...
374,4,1,...
384,4,1,...
414,4,1,...
415,4,1,...
416,4,1,...
419,4,1,...
421,4,1,...
424,4,1,...
429,4,1,...
430,4,1,...
450,4,1,...
464,4,1,...
466,4,1,...
469,4,1,...
24,3,1,...
36,3,1,...
50,3,1,...
57,3,1,...
76,3,1,...
115,3,1,...
122,3,1,...
144,3,1,...
146,3,2,...
155,3,1,...
157,3,1,...
158,3,1,...
160,3,1,...
161,3,1,...
168,3,1,...
209,3,1,...
216,3,1,...
217,3,1,...
218,3,1,...
241,3,1,...
247,3,1,...
274,3,1,...
275,3,1,...
276,3,1,...
278,3,1,...
282,3,1,...
285,3,1,...
289,3,1,...
296,3,1,...
298,3,1,...
303,3,1,...
310,3,1,...
314,3,1,...
333,3,1,...
347,3,1,...
353,3,1,...
355,3,1,...
364,3,1,...
365,3,1,...
373,3,1,...
377,3,1,...
378,3,1,...
409,3,1,...
413,3,1,...
417,3,1,...
418,3,1,...
428,3,1,...
459,3,1,...
467,3,1,...
470,3,1,...
9,2,1,...
34,2,1,...
37,2,1,...
58,2,1,...
80,2,1,...
104,2,1,...
109,2,1,...
111,2,1,...
116,2,1,...
117,2,1,...
124,2,1,...
125,2,1,...
130,2,1,...
132,2,1,...
133,2,1,...
149,2,1,...
150,2,1,...
151,2,1,...
153,2,1,...
171,2,1,...
177,2,1,...
178,2,1,...
181,2,1,...
187,2,1,...
195,2,1,...
214,2,1,...
223,2,1,...
230,2,1,...
236,2,1,...
280,2,1,...
288,2,1,...
297,2,1,...
304,2,1,...
309,2,1,...
312,2,1,...
322,2,1,...
324,2,1,...
325,2,1,...
334,2,1,...
345,2,1,...
346,2,1,...
354,2,1,...
359,2,1,...
361,2,1,...
375,2,1,...
392,2,1,...
396,2,1,...
398,2,1,...
403,2,1,...
404,2,1,...
406,2,1,...
427,2,1,...
438,2,1,...
442,2,1,...
454,2,1,...
457,2,1,...
468,2,1,...
18,1,1,...
19,1,1,...
35,1,1,...
38,1,1,...
49,1,1,...
51,1,1,...
54,1,1,...
70,1,1,...
71,1,1,...
72,1,1,...
73,1,1,...
74,1,1,...
78,1,1,...
98,1,1,...
102,1,1,...
103,1,1,...
105,1,1,...
106,1,1,...
107,1,1,...
128,1,1,...
152,1,1,...
174,1,1,...
176,1,1,...
180,1,1,...
191,1,1,...
192,1,1,...
194,1,1,...
196,1,1,...
197,1,1,...
212,1,1,...
225,1,1,...
226,1,1,...
231,1,1,...
250,1,1,...
255,1,1,...
269,1,1,...
271,1,1,...
279,1,1,...
281,1,1,...
283,1,1,...
284,1,1,...
294,1,1,...
299,1,1,...
308,1,1,...
315,1,1,...
316,1,1,...
317,1,1,...
319,1,1,...
321,1,1,...
340,1,1,...
341,1,1,...
342,1,1,...
343,1,1,...
344,1,1,...
350,1,1,...
356,1,1,...
357,1,1,...
362,1,1,...
379,1,1,...
393,1,1,...
394,1,1,...
395,1,1,...
397,1,1,...
399,1,1,...
402,1,1,...
410,1,1,...
425,1,1,...
439,1,1,...
440,1,1,...
441,1,1,...
443,1,1,...
447,1,1,...
448,1,1,...
455,1,1,...
456,1,1,...
458,1,1,...
463,1,1,...
1 e_id count max_max_ts dct_lst_init_remove_firm_prod
2 83 50 3 ...
3 135 50 3 ...
4 138 50 2 ...
5 179 50 3 ...
6 184 50 3 ...
7 190 50 3 ...
8 227 50 2 ...
9 307 50 2 ...
10 358 50 1 ...
11 372 50 1 ...
12 383 50 3 ...
13 405 50 3 ...
14 411 50 2 ...
15 412 50 2 ...
16 445 50 2 ...
17 29 25 1 ...
18 256 24 1 ...
19 257 23 1 ...
20 259 20 1 ...
21 28 19 1 ...
22 30 19 1 ...
23 258 18 1 ...
24 262 18 1 ...
25 260 17 1 ...
26 26 16 1 ...
27 32 16 1 ...
28 27 13 1 ...
29 53 13 1 ...
30 173 13 1 ...
31 400 13 1 ...
32 5 12 1 ...
33 31 12 1 ...
34 89 12 1 ...
35 140 12 1 ...
36 142 12 2 ...
37 234 12 1 ...
38 21 11 1 ...
39 64 11 1 ...
40 244 11 1 ...
41 290 11 1 ...
42 444 11 1 ...
43 65 10 1 ...
44 66 10 1 ...
45 68 10 1 ...
46 92 10 1 ...
47 94 10 1 ...
48 265 10 1 ...
49 335 10 2 ...
50 370 10 1 ...
51 380 10 1 ...
52 388 10 1 ...
53 401 10 1 ...
54 43 9 1 ...
55 45 9 1 ...
56 48 9 1 ...
57 67 9 1 ...
58 90 9 1 ...
59 95 9 1 ...
60 96 9 1 ...
61 143 9 1 ...
62 147 9 1 ...
63 163 9 1 ...
64 165 9 1 ...
65 201 9 1 ...
66 300 9 1 ...
67 306 9 1 ...
68 327 9 1 ...
69 330 9 1 ...
70 381 9 1 ...
71 387 9 1 ...
72 389 9 1 ...
73 8 8 1 ...
74 40 8 1 ...
75 44 8 1 ...
76 46 8 1 ...
77 62 8 1 ...
78 87 8 1 ...
79 91 8 1 ...
80 93 8 1 ...
81 203 8 1 ...
82 210 8 1 ...
83 211 8 1 ...
84 243 8 1 ...
85 313 8 1 ...
86 326 8 1 ...
87 371 8 1 ...
88 382 8 1 ...
89 385 8 1 ...
90 386 8 1 ...
91 391 8 1 ...
92 422 8 1 ...
93 435 8 1 ...
94 6 7 2 ...
95 14 7 1 ...
96 20 7 2 ...
97 47 7 1 ...
98 63 7 1 ...
99 141 7 2 ...
100 154 7 1 ...
101 164 7 1 ...
102 200 7 1 ...
103 204 7 1 ...
104 207 7 1 ...
105 237 7 1 ...
106 246 7 1 ...
107 252 7 1 ...
108 254 7 2 ...
109 261 7 1 ...
110 268 7 1 ...
111 270 7 1 ...
112 286 7 1 ...
113 432 7 1 ...
114 434 7 1 ...
115 436 7 1 ...
116 446 7 1 ...
117 451 7 1 ...
118 4 6 1 ...
119 15 6 1 ...
120 22 6 1 ...
121 25 6 1 ...
122 39 6 1 ...
123 41 6 1 ...
124 42 6 1 ...
125 52 6 1 ...
126 55 6 1 ...
127 56 6 1 ...
128 75 6 1 ...
129 81 6 1 ...
130 82 6 1 ...
131 84 6 1 ...
132 86 6 1 ...
133 113 6 1 ...
134 114 6 1 ...
135 127 6 1 ...
136 139 6 1 ...
137 159 6 1 ...
138 162 6 1 ...
139 233 6 1 ...
140 235 6 1 ...
141 267 6 1 ...
142 292 6 1 ...
143 295 6 1 ...
144 339 6 1 ...
145 349 6 1 ...
146 363 6 1 ...
147 449 6 1 ...
148 460 6 1 ...
149 461 6 1 ...
150 473 6 1 ...
151 474 6 1 ...
152 2 5 1 ...
153 3 5 1 ...
154 7 5 2 ...
155 13 5 1 ...
156 77 5 1 ...
157 101 5 1 ...
158 108 5 1 ...
159 112 5 1 ...
160 123 5 1 ...
161 166 5 1 ...
162 167 5 1 ...
163 202 5 1 ...
164 205 5 1 ...
165 206 5 1 ...
166 215 5 1 ...
167 222 5 1 ...
168 232 5 1 ...
169 238 5 1 ...
170 239 5 1 ...
171 248 5 1 ...
172 253 5 1 ...
173 266 5 1 ...
174 277 5 1 ...
175 331 5 1 ...
176 336 5 1 ...
177 337 5 1 ...
178 348 5 1 ...
179 367 5 1 ...
180 369 5 1 ...
181 376 5 1 ...
182 390 5 1 ...
183 420 5 1 ...
184 423 5 1 ...
185 431 5 1 ...
186 462 5 1 ...
187 465 5 1 ...
188 471 5 1 ...
189 472 5 1 ...
190 16 4 1 ...
191 17 4 1 ...
192 59 4 1 ...
193 60 4 1 ...
194 61 4 1 ...
195 79 4 1 ...
196 85 4 1 ...
197 88 4 1 ...
198 110 4 1 ...
199 126 4 1 ...
200 145 4 1 ...
201 156 4 1 ...
202 169 4 1 ...
203 170 4 1 ...
204 172 4 1 ...
205 219 4 1 ...
206 220 4 1 ...
207 221 4 1 ...
208 224 4 1 ...
209 228 4 1 ...
210 229 4 1 ...
211 245 4 1 ...
212 249 4 1 ...
213 251 4 1 ...
214 287 4 1 ...
215 291 4 1 ...
216 293 4 1 ...
217 305 4 1 ...
218 328 4 1 ...
219 329 4 1 ...
220 338 4 1 ...
221 352 4 1 ...
222 366 4 1 ...
223 374 4 1 ...
224 384 4 1 ...
225 414 4 1 ...
226 415 4 1 ...
227 416 4 1 ...
228 419 4 1 ...
229 421 4 1 ...
230 424 4 1 ...
231 429 4 1 ...
232 430 4 1 ...
233 450 4 1 ...
234 464 4 1 ...
235 466 4 1 ...
236 469 4 1 ...
237 24 3 1 ...
238 36 3 1 ...
239 50 3 1 ...
240 57 3 1 ...
241 76 3 1 ...
242 115 3 1 ...
243 122 3 1 ...
244 144 3 1 ...
245 146 3 2 ...
246 155 3 1 ...
247 157 3 1 ...
248 158 3 1 ...
249 160 3 1 ...
250 161 3 1 ...
251 168 3 1 ...
252 209 3 1 ...
253 216 3 1 ...
254 217 3 1 ...
255 218 3 1 ...
256 241 3 1 ...
257 247 3 1 ...
258 274 3 1 ...
259 275 3 1 ...
260 276 3 1 ...
261 278 3 1 ...
262 282 3 1 ...
263 285 3 1 ...
264 289 3 1 ...
265 296 3 1 ...
266 298 3 1 ...
267 303 3 1 ...
268 310 3 1 ...
269 314 3 1 ...
270 333 3 1 ...
271 347 3 1 ...
272 353 3 1 ...
273 355 3 1 ...
274 364 3 1 ...
275 365 3 1 ...
276 373 3 1 ...
277 377 3 1 ...
278 378 3 1 ...
279 409 3 1 ...
280 413 3 1 ...
281 417 3 1 ...
282 418 3 1 ...
283 428 3 1 ...
284 459 3 1 ...
285 467 3 1 ...
286 470 3 1 ...
287 9 2 1 ...
288 34 2 1 ...
289 37 2 1 ...
290 58 2 1 ...
291 80 2 1 ...
292 104 2 1 ...
293 109 2 1 ...
294 111 2 1 ...
295 116 2 1 ...
296 117 2 1 ...
297 124 2 1 ...
298 125 2 1 ...
299 130 2 1 ...
300 132 2 1 ...
301 133 2 1 ...
302 149 2 1 ...
303 150 2 1 ...
304 151 2 1 ...
305 153 2 1 ...
306 171 2 1 ...
307 177 2 1 ...
308 178 2 1 ...
309 181 2 1 ...
310 187 2 1 ...
311 195 2 1 ...
312 214 2 1 ...
313 223 2 1 ...
314 230 2 1 ...
315 236 2 1 ...
316 280 2 1 ...
317 288 2 1 ...
318 297 2 1 ...
319 304 2 1 ...
320 309 2 1 ...
321 312 2 1 ...
322 322 2 1 ...
323 324 2 1 ...
324 325 2 1 ...
325 334 2 1 ...
326 345 2 1 ...
327 346 2 1 ...
328 354 2 1 ...
329 359 2 1 ...
330 361 2 1 ...
331 375 2 1 ...
332 392 2 1 ...
333 396 2 1 ...
334 398 2 1 ...
335 403 2 1 ...
336 404 2 1 ...
337 406 2 1 ...
338 427 2 1 ...
339 438 2 1 ...
340 442 2 1 ...
341 454 2 1 ...
342 457 2 1 ...
343 468 2 1 ...
344 18 1 1 ...
345 19 1 1 ...
346 35 1 1 ...
347 38 1 1 ...
348 49 1 1 ...
349 51 1 1 ...
350 54 1 1 ...
351 70 1 1 ...
352 71 1 1 ...
353 72 1 1 ...
354 73 1 1 ...
355 74 1 1 ...
356 78 1 1 ...
357 98 1 1 ...
358 102 1 1 ...
359 103 1 1 ...
360 105 1 1 ...
361 106 1 1 ...
362 107 1 1 ...
363 128 1 1 ...
364 152 1 1 ...
365 174 1 1 ...
366 176 1 1 ...
367 180 1 1 ...
368 191 1 1 ...
369 192 1 1 ...
370 194 1 1 ...
371 196 1 1 ...
372 197 1 1 ...
373 212 1 1 ...
374 225 1 1 ...
375 226 1 1 ...
376 231 1 1 ...
377 250 1 1 ...
378 255 1 1 ...
379 269 1 1 ...
380 271 1 1 ...
381 279 1 1 ...
382 281 1 1 ...
383 283 1 1 ...
384 284 1 1 ...
385 294 1 1 ...
386 299 1 1 ...
387 308 1 1 ...
388 315 1 1 ...
389 316 1 1 ...
390 317 1 1 ...
391 319 1 1 ...
392 321 1 1 ...
393 340 1 1 ...
394 341 1 1 ...
395 342 1 1 ...
396 343 1 1 ...
397 344 1 1 ...
398 350 1 1 ...
399 356 1 1 ...
400 357 1 1 ...
401 362 1 1 ...
402 379 1 1 ...
403 393 1 1 ...
404 394 1 1 ...
405 395 1 1 ...
406 397 1 1 ...
407 399 1 1 ...
408 402 1 1 ...
409 410 1 1 ...
410 425 1 1 ...
411 439 1 1 ...
412 440 1 1 ...
413 441 1 1 ...
414 443 1 1 ...
415 447 1 1 ...
416 448 1 1 ...
417 455 1 1 ...
418 456 1 1 ...
419 458 1 1 ...
420 463 1 1 ...

View File

@ -0,0 +1,17 @@
select distinct s_id from iiabmdb.without_exp_result where ts > 0;
select s_id, max(ts) as max_ts from iiabmdb.without_exp_result where ts > 0 group by s_id order by max_ts;
select e_id, count(id) as count, max(max_ts) as max_max_ts from iiabmdb.without_exp_sample as a
inner join (select s_id, max(ts) as max_ts from iiabmdb.without_exp_result where ts > 0 group by s_id) as b
on a.id = b.s_id
group by e_id
order by count desc;
select e_id, count, max_max_ts, dct_lst_init_remove_firm_prod from iiabmdb.without_exp_experiment as a
inner join
(select e_id, count(id) as count, max(max_ts) as max_max_ts from iiabmdb.without_exp_sample as a
inner join (select s_id, max(ts) as max_ts from iiabmdb.without_exp_result where ts > 0 group by s_id) as b
on a.id = b.s_id
group by e_id) as b
on a.id = b.e_id
where count >= 9
order by count desc;

7
SQL_migrate_db.sql Normal file
View File

@ -0,0 +1,7 @@
CREATE DATABASE iiabmdb_dissertation;
RENAME TABLE iiabmdb.not_test_experiment TO iiabmdb_dissertation.not_test_experiment,
iiabmdb.not_test_result TO iiabmdb_dissertation.not_test_result,
iiabmdb.not_test_sample TO iiabmdb_dissertation.not_test_sample,
iiabmdb.test_experiment TO iiabmdb_dissertation.test_experiment,
iiabmdb.test_result TO iiabmdb_dissertation.test_result,
iiabmdb.test_sample TO iiabmdb_dissertation.test_sample;

View File

@ -1,3 +1,4 @@
select id, e_id, idx_sample, seed, ts_done from iiabmdb.without_exp_sample where is_done_flag != -1; select id, e_id, idx_sample, seed, ts_done from iiabmdb.without_exp_sample where is_done_flag != -1 order by ts_done;
select count(id) from iiabmdb.without_exp_sample where is_done_flag != -1; select count(id) from iiabmdb.without_exp_sample where is_done_flag != -1;
select count(id) from iiabmdb.without_exp_sample; select count(id) from iiabmdb.without_exp_sample;
select count(id) from iiabmdb.without_exp_sample where is_done_flag != -1;

Binary file not shown.

Binary file not shown.

View File

@ -9,6 +9,7 @@ import pandas as pd
import platform import platform
import networkx as nx import networkx as nx
import json import json
import pickle
class ControllerDB: class ControllerDB:
@ -45,13 +46,31 @@ class ControllerDB:
Firm.fillna(0, inplace=True) Firm.fillna(0, inplace=True)
# fill dct_lst_init_remove_firm_prod # fill dct_lst_init_remove_firm_prod
list_dct = [] # list_dct = []
for _, row in Firm.iterrows(): # for _, row in Firm.iterrows():
code = row['Code'] # code = row['Code']
row = row['1':] # row = row['1':]
for product_code in row.index[row == 1].to_list(): # for product_code in row.index[row == 1].to_list():
dct = {code: [product_code]} # dct = {code: [product_code]}
list_dct.append(dct) # list_dct.append(dct)
str_sql = "select e_id, count, max_max_ts, " \
"dct_lst_init_remove_firm_prod from " \
"iiabmdb.without_exp_experiment as a " \
"inner join " \
"(select e_id, count(id) as count, max(max_ts) as max_max_ts " \
"from iiabmdb.without_exp_sample as a " \
"inner join (select s_id, max(ts) as max_ts from " \
"iiabmdb.without_exp_result where ts > 0 group by s_id) as b " \
"on a.id = b.s_id " \
"group by e_id) as b " \
"on a.id = b.e_id " \
"order by count desc;"
result = pd.read_sql(sql=str_sql, con=engine)
result['dct_lst_init_remove_firm_prod'] = \
result['dct_lst_init_remove_firm_prod'].apply(
lambda x: pickle.loads(x))
list_dct = result.loc[result['count'] >= 9,
'dct_lst_init_remove_firm_prod'].to_list()
# list_dct = [{'140': ['1.4.5.1']}] # list_dct = [{'140': ['1.4.5.1']}]
# list_dct = [{'133': ['1.4.4.1']}] # list_dct = [{'133': ['1.4.4.1']}]
# list_dct = [{'2': ['1.1.3']}] # list_dct = [{'2': ['1.1.3']}]
@ -74,7 +93,7 @@ class ControllerDB:
# insert exp # insert exp
df_xv = pd.read_csv("xv.csv", index_col=None) df_xv = pd.read_csv("xv.csv", index_col=None)
# read the OA table # read the OA table
df_oa = pd.read_csv("oa.csv", index_col=None) df_oa = pd.read_csv("oa_with_exp.csv", index_col=None)
for idx_scenario, row in df_oa.iterrows(): for idx_scenario, row in df_oa.iterrows():
dct_exp_para = {} dct_exp_para = {}
for idx_col, para_level in enumerate(row): for idx_col, para_level in enumerate(row):

30
oa_L27.txt Normal file
View File

@ -0,0 +1,30 @@
X X X X X X X X X X X X X
1 2 3 4 5 6 7 8 9 10 11 12 13
-------------------------------------------
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 2 2 2 2 2 2 2 2 2
1 1 1 1 3 3 3 3 3 3 3 3 3
1 2 2 2 1 1 1 2 2 2 3 3 3
1 2 2 2 2 2 2 3 3 3 1 1 1
1 2 2 2 3 3 3 1 1 1 2 2 2
1 3 3 3 1 1 1 3 3 3 2 2 2
1 3 3 3 2 2 2 1 1 1 3 3 3
1 3 3 3 3 3 3 2 2 2 1 1 1
2 1 2 3 1 2 3 1 2 3 1 2 3
2 1 2 3 2 3 1 2 3 1 2 3 1
2 1 2 3 3 1 2 3 1 2 3 1 2
2 2 3 1 1 2 3 2 3 1 3 1 2
2 2 3 1 2 3 1 3 1 2 1 2 3
2 2 3 1 3 1 2 1 2 3 2 3 1
2 3 1 2 1 2 3 3 1 2 2 3 1
2 3 1 2 2 3 1 1 2 3 3 1 2
2 3 1 2 3 1 2 2 3 1 1 2 3
3 1 3 2 1 3 2 1 3 2 1 3 2
3 1 3 2 2 1 3 2 1 3 2 1 3
3 1 3 2 3 2 1 3 2 1 3 2 1
3 2 1 3 1 3 2 2 1 3 3 2 1
3 2 1 3 2 1 3 3 2 1 1 3 2
3 2 1 3 3 2 1 1 3 2 2 1 3
3 3 2 1 1 3 2 3 2 1 2 1 3
3 3 2 1 2 1 3 1 3 2 3 2 1
3 3 2 1 3 2 1 2 1 3 1 3 2

28
oa_with_exp.csv Normal file
View File

@ -0,0 +1,28 @@
X1,X2,X3,X4,X5,X6,X7,X8,X9
0,0,0,0,0,0,0,0,0
0,0,0,0,1,1,1,1,1
0,0,0,0,2,2,2,2,2
0,1,1,1,0,0,0,1,1
0,1,1,1,1,1,1,2,2
0,1,1,1,2,2,2,0,0
0,2,2,2,0,0,0,2,2
0,2,2,2,1,1,1,0,0
0,2,2,2,2,2,2,1,1
1,0,1,2,0,1,2,0,1
1,0,1,2,1,2,0,1,2
1,0,1,2,2,0,1,2,0
1,1,2,0,0,1,2,1,2
1,1,2,0,1,2,0,2,0
1,1,2,0,2,0,1,0,1
1,2,0,1,0,1,2,2,0
1,2,0,1,1,2,0,0,1
1,2,0,1,2,0,1,1,2
2,0,2,1,0,2,1,0,2
2,0,2,1,1,0,2,1,0
2,0,2,1,2,1,0,2,1
2,1,0,2,0,2,1,1,0
2,1,0,2,1,0,2,2,1
2,1,0,2,2,1,0,0,2
2,2,1,0,0,2,1,2,1
2,2,1,0,1,0,2,0,2
2,2,1,0,2,1,0,1,0
1 X1 X2 X3 X4 X5 X6 X7 X8 X9
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 1 1 1 1 1
4 0 0 0 0 2 2 2 2 2
5 0 1 1 1 0 0 0 1 1
6 0 1 1 1 1 1 1 2 2
7 0 1 1 1 2 2 2 0 0
8 0 2 2 2 0 0 0 2 2
9 0 2 2 2 1 1 1 0 0
10 0 2 2 2 2 2 2 1 1
11 1 0 1 2 0 1 2 0 1
12 1 0 1 2 1 2 0 1 2
13 1 0 1 2 2 0 1 2 0
14 1 1 2 0 0 1 2 1 2
15 1 1 2 0 1 2 0 2 0
16 1 1 2 0 2 0 1 0 1
17 1 2 0 1 0 1 2 2 0
18 1 2 0 1 1 2 0 0 1
19 1 2 0 1 2 0 1 1 2
20 2 0 2 1 0 2 1 0 2
21 2 0 2 1 1 0 2 1 0
22 2 0 2 1 2 1 0 2 1
23 2 1 0 2 0 2 1 1 0
24 2 1 0 2 1 0 2 2 1
25 2 1 0 2 2 1 0 0 2
26 2 2 1 0 0 2 1 2 1
27 2 2 1 0 1 0 2 0 2
28 2 2 1 0 2 1 0 1 0

View File

@ -136,6 +136,38 @@
"\n", "\n",
"print(mp.cpu_count())" "print(mp.cpu_count())"
] ]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"71\n"
]
}
],
"source": [
"from orm import engine\n",
"import pandas as pd\n",
"import pickle\n",
"str_sql = \"select e_id, count, max_max_ts, dct_lst_init_remove_firm_prod from iiabmdb.without_exp_experiment as a \" \\\n",
"\"inner join \" \\\n",
"\"(select e_id, count(id) as count, max(max_ts) as max_max_ts from iiabmdb.without_exp_sample as a \" \\\n",
"\"inner join (select s_id, max(ts) as max_ts from iiabmdb.without_exp_result where ts > 0 group by s_id) as b \" \\\n",
"\"on a.id = b.s_id \" \\\n",
"\"group by e_id) as b \" \\\n",
"\"on a.id = b.e_id \" \\\n",
"\"order by count desc;\"\n",
"result = pd.read_sql(sql=str_sql, con=engine)\n",
"result['dct_lst_init_remove_firm_prod'] = result['dct_lst_init_remove_firm_prod'].apply(lambda x: pickle.loads(x))\n",
"# print(result)\n",
"list_dct = result.loc[result['count']>=9, 'dct_lst_init_remove_firm_prod'].to_list()\n",
"print(len(list_dct))"
]
} }
], ],
"metadata": { "metadata": {