修改图形代码漏洞

This commit is contained in:
Cricial 2025-02-03 22:23:18 +08:00
parent 42fba119d1
commit 0da29d58d6
13 changed files with 56882 additions and 290 deletions

View File

@ -54,7 +54,7 @@ def do_computation(c_db):
if __name__ == '__main__':
# 输入参数
parser = argparse.ArgumentParser(description='setting')
parser.add_argument('--exp', type=str, default='with_exp')
parser.add_argument('--exp', type=str, default='without_exp')
parser.add_argument('--job', type=int, default='4')
parser.add_argument('--reset_sample', type=int, default='0')
parser.add_argument('--reset_db', type=bool, default=False)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

View File

@ -1,46 +1,164 @@
id_firm,count
126,6
85,5
100,3
80,3
79,3
99,3
57,2
74,2
13,2
97,2
94,2
93,2
108,2
45,2
68,2
53,2
106,2
73,2
75,2
58,1
124,1
77,1
117,1
81,1
84,1
98,1
115,1
49,1
50,1
159,1
131,1
135,1
14,1
142,1
148,1
149,1
21,1
119,1
22,1
23,1
25,1
26,1
31,1
41,1
36,1
70634828,5066
3147511625,5066
653528340,5052
3103797386,5046
888395016,5046
301209792,5046
2327031723,5042
2317245827,5036
631449822,5032
2348941764,5026
194210021,5022
191912252,5012
3048263744,5002
3215814536,4996
2354145351,4992
2312490120,1910
503176785,1850
25685135,1566
2944892892,1556
2624175,1546
3269039233,1546
3445928818,1476
2321109759,1466
3299144127,1456
930767828,726
3407754893,716
571058167,350
343012684,350
750610681,350
2317841563,350
888356483,350
2320475044,350
43407343,350
152008168,350
413274977,350
3111033905,350
3069206426,350
25945288,350
607512171,340
448033045,340
1452048,20
2311838590,20
2424229017,20
3373311444,20
11807506,20
400488703,10
420984285,10
400692942,10
4208851809,10
3445244192,10
888478182,10
354897041,10
9,10
4518234098,10
3433628561,10
3398677646,10
3395900897,10
3384021594,10
3372913783,10
3344297292,10
3312358902,10
9746245,10
887840774,10
5007015990,10
453289520,10
593312758,10
7299120,10
7,10
762985858,10
695995052,10
688155470,10
654825436,10
771821595,10
80158773,10
644292599,10
829768,10
620220747,10
615763365,10
594378026,10
857978527,10
474279224,10
591452402,10
5849940,10
3271705843,10
581407487,10
561545339,10
560866402,10
549184982,10
863079,10
5278074,10
868012326,10
71271700,10
495782506,10
483081978,10
1033972427,10
3127420424,10
3269940677,10
218633337,10
2343704209,10
2341555098,10
2339684065,10
2339188563,10
2337952436,10
2333843479,10
2329375731,10
2327979389,10
2326478786,10
2324844174,10
2324787028,10
2320102626,10
2316990095,10
2310825263,10
213386023,10
2352036411,10
203314437,10
2010673,10
1679596339,10
1606833003,10
159511306,10
15613202,10
1549474227,10
151606446,10
145511905,10
1375606900,10
1307012237,10
1217957486,10
118882692,10
1128343125,10
2349656760,10
24284343,10
3267688490,10
24673506,10
3226664625,10
3221190269,10
3211956484,10
3203777710,10
3195502499,10
3188903709,10
3177507356,10
3133307899,10
3122923980,10
3120341363,10
3113895788,10
3072715478,10
3070859372,10
3047163873,10
3045721313,10
3026382513,10
3025036704,10
29954548,10
2820140348,10
278221281,10
27731896,10
2728939,10
271860868,10
27075840,10
26516263,10
26162741,10
2545430247,10
251189644,10
25036634,10
996174506,10
11164476478,6

1 id_firm count
2 126 70634828 6 5066
3 85 3147511625 5 5066
4 100 653528340 3 5052
5 80 3103797386 3 5046
6 79 888395016 3 5046
7 99 301209792 3 5046
8 57 2327031723 2 5042
9 74 2317245827 2 5036
10 13 631449822 2 5032
11 97 2348941764 2 5026
12 94 194210021 2 5022
13 93 191912252 2 5012
14 108 3048263744 2 5002
15 45 3215814536 2 4996
16 68 2354145351 2 4992
17 53 2312490120 2 1910
18 106 503176785 2 1850
19 73 25685135 2 1566
20 75 2944892892 2 1556
21 58 2624175 1 1546
22 124 3269039233 1 1546
23 77 3445928818 1 1476
24 117 2321109759 1 1466
25 81 3299144127 1 1456
26 84 930767828 1 726
27 98 3407754893 1 716
28 115 571058167 1 350
29 49 343012684 1 350
30 50 750610681 1 350
31 159 2317841563 1 350
32 131 888356483 1 350
33 135 2320475044 1 350
34 14 43407343 1 350
35 142 152008168 1 350
36 148 413274977 1 350
37 149 3111033905 1 350
38 21 3069206426 1 350
39 119 25945288 1 350
40 22 607512171 1 340
41 23 448033045 1 340
42 25 1452048 1 20
43 26 2311838590 1 20
44 31 2424229017 1 20
45 41 3373311444 1 20
46 36 11807506 1 20
47 400488703 10
48 420984285 10
49 400692942 10
50 4208851809 10
51 3445244192 10
52 888478182 10
53 354897041 10
54 9 10
55 4518234098 10
56 3433628561 10
57 3398677646 10
58 3395900897 10
59 3384021594 10
60 3372913783 10
61 3344297292 10
62 3312358902 10
63 9746245 10
64 887840774 10
65 5007015990 10
66 453289520 10
67 593312758 10
68 7299120 10
69 7 10
70 762985858 10
71 695995052 10
72 688155470 10
73 654825436 10
74 771821595 10
75 80158773 10
76 644292599 10
77 829768 10
78 620220747 10
79 615763365 10
80 594378026 10
81 857978527 10
82 474279224 10
83 591452402 10
84 5849940 10
85 3271705843 10
86 581407487 10
87 561545339 10
88 560866402 10
89 549184982 10
90 863079 10
91 5278074 10
92 868012326 10
93 71271700 10
94 495782506 10
95 483081978 10
96 1033972427 10
97 3127420424 10
98 3269940677 10
99 218633337 10
100 2343704209 10
101 2341555098 10
102 2339684065 10
103 2339188563 10
104 2337952436 10
105 2333843479 10
106 2329375731 10
107 2327979389 10
108 2326478786 10
109 2324844174 10
110 2324787028 10
111 2320102626 10
112 2316990095 10
113 2310825263 10
114 213386023 10
115 2352036411 10
116 203314437 10
117 2010673 10
118 1679596339 10
119 1606833003 10
120 159511306 10
121 15613202 10
122 1549474227 10
123 151606446 10
124 145511905 10
125 1375606900 10
126 1307012237 10
127 1217957486 10
128 118882692 10
129 1128343125 10
130 2349656760 10
131 24284343 10
132 3267688490 10
133 24673506 10
134 3226664625 10
135 3221190269 10
136 3211956484 10
137 3203777710 10
138 3195502499 10
139 3188903709 10
140 3177507356 10
141 3133307899 10
142 3122923980 10
143 3120341363 10
144 3113895788 10
145 3072715478 10
146 3070859372 10
147 3047163873 10
148 3045721313 10
149 3026382513 10
150 3025036704 10
151 29954548 10
152 2820140348 10
153 278221281 10
154 27731896 10
155 2728939 10
156 271860868 10
157 27075840 10
158 26516263 10
159 26162741 10
160 2545430247 10
161 251189644 10
162 25036634 10
163 996174506 10
164 11164476478 6

View File

@ -1,58 +1,359 @@
id_firm,id_product,count
126,2.1.3,4
100,1.3.1,3
85,1.3.1,3
106,2.1.3,2
68,1.3.1.3,2
73,2.1.3,2
74,2.1.3,2
75,1.3.3,2
85,2.1.1,2
80,1.3.4,2
93,1.3.1,2
94,1.1,2
108,2.1.3,2
99,1.3.1,2
53,1.4.5.6,1
57,1.3.3.3,1
57,2.3.1,1
58,1.3.4.3,1
98,2,1
97,2.1.3,1
97,1.3.3,1
77,1.3.4,1
79,2.1.3.2,1
79,2.1.3.7,1
79,2.1.4.1,1
50,1.3.1.5,1
80,2.1.1,1
81,1.3.4,1
84,2.3,1
53,1.4.3.4,1
45,2.1.4.1.1,1
49,1.3.1.4,1
45,1.3.4.2,1
115,1.1.3,1
117,2.1.1.4,1
119,1.3.1.1,1
124,2.3,1
126,1.1,1
126,2.1.1.5,1
13,2.1.3.4,1
13,2.1.3.7,1
131,2.1.1.5,1
135,2.2,1
14,1.3.3.4,1
142,1.4.3,1
148,2.1.3,1
149,2.1.2.2,1
159,2.1.2,1
21,1.3.1.3,1
22,2.1.3.7,1
23,2.3.1,1
25,1.3.1.7,1
26,2.1.3.4,1
31,1.3.3.3,1
36,1.1.1,1
41,1.4.5,1
99,1.3.3,1
25685135,99,1566
2944892892,99,1556
3269039233,99,1546
2624175,99,1546
3445928818,95,1476
2321109759,95,1466
3299144127,95,1456
930767828,90,726
3407754893,90,716
194210021,50,646
3147511625,50,646
2327031723,50,646
191912252,50,646
631449822,50,646
653528340,50,636
2348941764,50,636
2317245827,50,636
3215814536,50,636
888395016,50,636
70634828,50,636
301209792,50,636
2354145351,50,636
3048263744,50,636
3103797386,50,636
2317245827,54,596
301209792,54,596
2317245827,51,596
3048263744,54,596
3103797386,51,596
194210021,54,596
194210021,53,596
2348941764,51,596
191912252,54,596
191912252,53,596
3215814536,53,596
3215814536,54,596
2348941764,54,596
2354145351,53,596
888395016,53,596
70634828,53,596
70634828,54,596
2327031723,54,596
3147511625,54,596
2327031723,53,596
653528340,54,596
653528340,53,596
631449822,54,596
2327031723,51,586
2354145351,54,586
301209792,51,586
2317245827,53,586
301209792,53,586
653528340,51,586
3215814536,51,586
3048263744,53,586
888395016,51,586
3103797386,54,586
3147511625,51,586
3103797386,53,586
3048263744,51,586
888395016,54,586
194210021,51,586
2354145351,51,576
191912252,51,576
631449822,51,576
2348941764,53,576
3147511625,53,576
631449822,53,576
70634828,51,576
653528340,52,556
70634828,52,556
3147511625,52,556
888395016,52,556
631449822,52,556
3103797386,52,546
301209792,52,546
2327031723,52,546
3147511625,55,536
2354145351,52,536
888395016,55,536
2348941764,52,536
631449822,55,536
653528340,55,536
2317245827,52,536
3048263744,52,536
70634828,55,536
191912252,52,536
194210021,52,536
3103797386,55,526
301209792,55,526
2327031723,55,526
3215814536,52,526
2354145351,55,516
2348941764,55,516
194210021,55,516
3048263744,55,516
2317245827,55,516
191912252,55,516
3215814536,55,506
2312490120,39,380
503176785,43,366
2312490120,43,366
3069206426,93,350
3111033905,93,350
571058167,94,350
25945288,93,350
43407343,93,350
343012684,92,350
413274977,91,350
888356483,91,350
503176785,40,350
2320475044,94,350
152008168,94,350
2317841563,91,350
750610681,92,350
448033045,94,340
607512171,91,340
2312490120,40,336
2312490120,38,336
503176785,38,326
503176785,39,316
2348941764,49,260
2348941764,48,260
3103797386,45,260
2317245827,44,260
2317245827,45,260
2317245827,46,260
301209792,49,260
301209792,48,260
3103797386,44,260
3103797386,48,260
3103797386,46,260
888395016,46,260
3215814536,49,260
3215814536,48,260
3215814536,47,260
3215814536,46,260
888395016,49,260
888395016,48,260
888395016,47,260
3147511625,49,260
3103797386,47,260
3147511625,48,260
3147511625,47,260
3147511625,46,260
3147511625,45,260
3147511625,44,260
3103797386,49,260
301209792,46,260
301209792,47,260
70634828,44,260
301209792,45,260
2348941764,44,260
301209792,44,260
2317245827,49,260
70634828,49,260
70634828,48,260
70634828,46,260
70634828,47,260
70634828,45,260
2317245827,47,260
2348941764,45,260
2348941764,46,260
2348941764,47,260
2317245827,48,260
631449822,45,256
191912252,49,256
191912252,48,256
191912252,47,256
191912252,46,256
631449822,48,256
191912252,45,256
631449822,47,256
631449822,46,256
2327031723,49,256
631449822,44,256
2327031723,48,256
2354145351,44,256
2327031723,47,256
191912252,44,256
2354145351,49,256
2354145351,48,256
2354145351,47,256
2354145351,46,256
2354145351,45,256
194210021,44,256
3048263744,45,256
2327031723,46,256
3048263744,49,256
653528340,44,256
653528340,45,256
653528340,46,256
2312490120,41,256
653528340,47,256
653528340,48,256
3048263744,44,256
3048263744,46,256
3048263744,47,256
3048263744,48,256
653528340,49,256
503176785,41,256
194210021,49,256
194210021,48,256
2327031723,45,256
194210021,47,256
2327031723,44,256
194210021,46,256
194210021,45,256
631449822,49,256
888395016,44,250
888395016,45,250
3215814536,45,250
3215814536,44,250
503176785,42,236
2312490120,42,236
549184982,69,10
474279224,71,10
4518234098,12,10
453289520,37,10
581407487,72,10
483081978,36,10
5007015990,74,10
495782506,19,10
5278074,36,10
561545339,33,10
560866402,9,10
1033972427,61,10
5849940,26,10
7299120,32,10
9746245,97,10
9,37,10
888478182,9,10
888395016,7,10
887840774,8,10
868012326,29,10
863079,11,10
857978527,60,10
829768,23,10
80158773,69,10
771821595,10,10
762985858,72,10
71271700,27,10
591452402,66,10
70634828,7,10
7,10,10
695995052,8,10
420984285,16,10
654825436,61,10
653528340,7,10
644292599,11,10
631449822,7,10
620220747,15,10
615763365,68,10
594378026,27,10
593312758,31,10
688155470,30,10
3070859372,62,10
4208851809,16,10
2337952436,24,10
2316990095,66,10
2317245827,7,10
2320102626,18,10
2324787028,18,10
2324844174,67,10
2326478786,60,10
2327031723,7,10
2327979389,13,10
2329375731,31,10
2333843479,70,10
2339188563,37,10
25036634,31,10
2339684065,74,10
2341555098,11,10
2343704209,69,10
2348941764,7,10
2349656760,79,10
2352036411,17,10
2354145351,7,10
2424229017,26,10
2424229017,30,10
24284343,35,10
2311838590,97,10
2311838590,34,10
2310825263,15,10
218633337,33,10
1128343125,63,10
11807506,23,10
11807506,60,10
118882692,35,10
1217957486,31,10
1307012237,68,10
1375606900,67,10
1452048,30,10
1452048,63,10
145511905,68,10
151606446,61,10
1549474227,67,10
15613202,32,10
159511306,69,10
1606833003,9,10
1679596339,74,10
191912252,7,10
194210021,7,10
2010673,64,10
203314437,22,10
213386023,19,10
24673506,67,10
251189644,23,10
400692942,68,10
3312358902,59,10
3188903709,65,10
3195502499,18,10
3203777710,74,10
3211956484,34,10
3215814536,7,10
3221190269,20,10
3226664625,28,10
3267688490,73,10
3269940677,28,10
3271705843,62,10
3344297292,12,10
2545430247,25,10
3372913783,20,10
3373311444,20,10
3373311444,71,10
3384021594,64,10
3395900897,73,10
3398677646,79,10
3433628561,29,10
3445244192,24,10
354897041,72,10
400488703,28,10
3177507356,24,10
3147511625,7,10
3133307899,23,10
3127420424,32,10
26162741,11,10
26516263,8,10
27075840,65,10
271860868,12,10
2728939,63,10
27731896,20,10
278221281,66,10
2820140348,62,10
29954548,27,10
301209792,7,10
3025036704,17,10
3026382513,15,10
3045721313,25,10
3047163873,27,10
3048263744,7,10
3072715478,33,10
3103797386,7,10
3113895788,35,10
3120341363,79,10
3122923980,34,10
996174506,15,10
11164476478,60,6

1 id_firm id_product count
2 126 25685135 2.1.3 99 4 1566
3 100 2944892892 1.3.1 99 3 1556
4 85 3269039233 1.3.1 99 3 1546
5 106 2624175 2.1.3 99 2 1546
6 68 3445928818 1.3.1.3 95 2 1476
7 73 2321109759 2.1.3 95 2 1466
8 74 3299144127 2.1.3 95 2 1456
9 75 930767828 1.3.3 90 2 726
10 85 3407754893 2.1.1 90 2 716
11 80 194210021 1.3.4 50 2 646
12 93 3147511625 1.3.1 50 2 646
13 94 2327031723 1.1 50 2 646
14 108 191912252 2.1.3 50 2 646
15 99 631449822 1.3.1 50 2 646
16 53 653528340 1.4.5.6 50 1 636
17 57 2348941764 1.3.3.3 50 1 636
18 57 2317245827 2.3.1 50 1 636
19 58 3215814536 1.3.4.3 50 1 636
20 98 888395016 2 50 1 636
21 97 70634828 2.1.3 50 1 636
22 97 301209792 1.3.3 50 1 636
23 77 2354145351 1.3.4 50 1 636
24 79 3048263744 2.1.3.2 50 1 636
25 79 3103797386 2.1.3.7 50 1 636
26 79 2317245827 2.1.4.1 54 1 596
27 50 301209792 1.3.1.5 54 1 596
28 80 2317245827 2.1.1 51 1 596
29 81 3048263744 1.3.4 54 1 596
30 84 3103797386 2.3 51 1 596
31 53 194210021 1.4.3.4 54 1 596
32 45 194210021 2.1.4.1.1 53 1 596
33 49 2348941764 1.3.1.4 51 1 596
34 45 191912252 1.3.4.2 54 1 596
35 115 191912252 1.1.3 53 1 596
36 117 3215814536 2.1.1.4 53 1 596
37 119 3215814536 1.3.1.1 54 1 596
38 124 2348941764 2.3 54 1 596
39 126 2354145351 1.1 53 1 596
40 126 888395016 2.1.1.5 53 1 596
41 13 70634828 2.1.3.4 53 1 596
42 13 70634828 2.1.3.7 54 1 596
43 131 2327031723 2.1.1.5 54 1 596
44 135 3147511625 2.2 54 1 596
45 14 2327031723 1.3.3.4 53 1 596
46 142 653528340 1.4.3 54 1 596
47 148 653528340 2.1.3 53 1 596
48 149 631449822 2.1.2.2 54 1 596
49 159 2327031723 2.1.2 51 1 586
50 21 2354145351 1.3.1.3 54 1 586
51 22 301209792 2.1.3.7 51 1 586
52 23 2317245827 2.3.1 53 1 586
53 25 301209792 1.3.1.7 53 1 586
54 26 653528340 2.1.3.4 51 1 586
55 31 3215814536 1.3.3.3 51 1 586
56 36 3048263744 1.1.1 53 1 586
57 41 888395016 1.4.5 51 1 586
58 99 3103797386 1.3.3 54 1 586
59 3147511625 51 586
60 3103797386 53 586
61 3048263744 51 586
62 888395016 54 586
63 194210021 51 586
64 2354145351 51 576
65 191912252 51 576
66 631449822 51 576
67 2348941764 53 576
68 3147511625 53 576
69 631449822 53 576
70 70634828 51 576
71 653528340 52 556
72 70634828 52 556
73 3147511625 52 556
74 888395016 52 556
75 631449822 52 556
76 3103797386 52 546
77 301209792 52 546
78 2327031723 52 546
79 3147511625 55 536
80 2354145351 52 536
81 888395016 55 536
82 2348941764 52 536
83 631449822 55 536
84 653528340 55 536
85 2317245827 52 536
86 3048263744 52 536
87 70634828 55 536
88 191912252 52 536
89 194210021 52 536
90 3103797386 55 526
91 301209792 55 526
92 2327031723 55 526
93 3215814536 52 526
94 2354145351 55 516
95 2348941764 55 516
96 194210021 55 516
97 3048263744 55 516
98 2317245827 55 516
99 191912252 55 516
100 3215814536 55 506
101 2312490120 39 380
102 503176785 43 366
103 2312490120 43 366
104 3069206426 93 350
105 3111033905 93 350
106 571058167 94 350
107 25945288 93 350
108 43407343 93 350
109 343012684 92 350
110 413274977 91 350
111 888356483 91 350
112 503176785 40 350
113 2320475044 94 350
114 152008168 94 350
115 2317841563 91 350
116 750610681 92 350
117 448033045 94 340
118 607512171 91 340
119 2312490120 40 336
120 2312490120 38 336
121 503176785 38 326
122 503176785 39 316
123 2348941764 49 260
124 2348941764 48 260
125 3103797386 45 260
126 2317245827 44 260
127 2317245827 45 260
128 2317245827 46 260
129 301209792 49 260
130 301209792 48 260
131 3103797386 44 260
132 3103797386 48 260
133 3103797386 46 260
134 888395016 46 260
135 3215814536 49 260
136 3215814536 48 260
137 3215814536 47 260
138 3215814536 46 260
139 888395016 49 260
140 888395016 48 260
141 888395016 47 260
142 3147511625 49 260
143 3103797386 47 260
144 3147511625 48 260
145 3147511625 47 260
146 3147511625 46 260
147 3147511625 45 260
148 3147511625 44 260
149 3103797386 49 260
150 301209792 46 260
151 301209792 47 260
152 70634828 44 260
153 301209792 45 260
154 2348941764 44 260
155 301209792 44 260
156 2317245827 49 260
157 70634828 49 260
158 70634828 48 260
159 70634828 46 260
160 70634828 47 260
161 70634828 45 260
162 2317245827 47 260
163 2348941764 45 260
164 2348941764 46 260
165 2348941764 47 260
166 2317245827 48 260
167 631449822 45 256
168 191912252 49 256
169 191912252 48 256
170 191912252 47 256
171 191912252 46 256
172 631449822 48 256
173 191912252 45 256
174 631449822 47 256
175 631449822 46 256
176 2327031723 49 256
177 631449822 44 256
178 2327031723 48 256
179 2354145351 44 256
180 2327031723 47 256
181 191912252 44 256
182 2354145351 49 256
183 2354145351 48 256
184 2354145351 47 256
185 2354145351 46 256
186 2354145351 45 256
187 194210021 44 256
188 3048263744 45 256
189 2327031723 46 256
190 3048263744 49 256
191 653528340 44 256
192 653528340 45 256
193 653528340 46 256
194 2312490120 41 256
195 653528340 47 256
196 653528340 48 256
197 3048263744 44 256
198 3048263744 46 256
199 3048263744 47 256
200 3048263744 48 256
201 653528340 49 256
202 503176785 41 256
203 194210021 49 256
204 194210021 48 256
205 2327031723 45 256
206 194210021 47 256
207 2327031723 44 256
208 194210021 46 256
209 194210021 45 256
210 631449822 49 256
211 888395016 44 250
212 888395016 45 250
213 3215814536 45 250
214 3215814536 44 250
215 503176785 42 236
216 2312490120 42 236
217 549184982 69 10
218 474279224 71 10
219 4518234098 12 10
220 453289520 37 10
221 581407487 72 10
222 483081978 36 10
223 5007015990 74 10
224 495782506 19 10
225 5278074 36 10
226 561545339 33 10
227 560866402 9 10
228 1033972427 61 10
229 5849940 26 10
230 7299120 32 10
231 9746245 97 10
232 9 37 10
233 888478182 9 10
234 888395016 7 10
235 887840774 8 10
236 868012326 29 10
237 863079 11 10
238 857978527 60 10
239 829768 23 10
240 80158773 69 10
241 771821595 10 10
242 762985858 72 10
243 71271700 27 10
244 591452402 66 10
245 70634828 7 10
246 7 10 10
247 695995052 8 10
248 420984285 16 10
249 654825436 61 10
250 653528340 7 10
251 644292599 11 10
252 631449822 7 10
253 620220747 15 10
254 615763365 68 10
255 594378026 27 10
256 593312758 31 10
257 688155470 30 10
258 3070859372 62 10
259 4208851809 16 10
260 2337952436 24 10
261 2316990095 66 10
262 2317245827 7 10
263 2320102626 18 10
264 2324787028 18 10
265 2324844174 67 10
266 2326478786 60 10
267 2327031723 7 10
268 2327979389 13 10
269 2329375731 31 10
270 2333843479 70 10
271 2339188563 37 10
272 25036634 31 10
273 2339684065 74 10
274 2341555098 11 10
275 2343704209 69 10
276 2348941764 7 10
277 2349656760 79 10
278 2352036411 17 10
279 2354145351 7 10
280 2424229017 26 10
281 2424229017 30 10
282 24284343 35 10
283 2311838590 97 10
284 2311838590 34 10
285 2310825263 15 10
286 218633337 33 10
287 1128343125 63 10
288 11807506 23 10
289 11807506 60 10
290 118882692 35 10
291 1217957486 31 10
292 1307012237 68 10
293 1375606900 67 10
294 1452048 30 10
295 1452048 63 10
296 145511905 68 10
297 151606446 61 10
298 1549474227 67 10
299 15613202 32 10
300 159511306 69 10
301 1606833003 9 10
302 1679596339 74 10
303 191912252 7 10
304 194210021 7 10
305 2010673 64 10
306 203314437 22 10
307 213386023 19 10
308 24673506 67 10
309 251189644 23 10
310 400692942 68 10
311 3312358902 59 10
312 3188903709 65 10
313 3195502499 18 10
314 3203777710 74 10
315 3211956484 34 10
316 3215814536 7 10
317 3221190269 20 10
318 3226664625 28 10
319 3267688490 73 10
320 3269940677 28 10
321 3271705843 62 10
322 3344297292 12 10
323 2545430247 25 10
324 3372913783 20 10
325 3373311444 20 10
326 3373311444 71 10
327 3384021594 64 10
328 3395900897 73 10
329 3398677646 79 10
330 3433628561 29 10
331 3445244192 24 10
332 354897041 72 10
333 400488703 28 10
334 3177507356 24 10
335 3147511625 7 10
336 3133307899 23 10
337 3127420424 32 10
338 26162741 11 10
339 26516263 8 10
340 27075840 65 10
341 271860868 12 10
342 2728939 63 10
343 27731896 20 10
344 278221281 66 10
345 2820140348 62 10
346 29954548 27 10
347 301209792 7 10
348 3025036704 17 10
349 3026382513 15 10
350 3045721313 25 10
351 3047163873 27 10
352 3048263744 7 10
353 3072715478 33 10
354 3103797386 7 10
355 3113895788 35 10
356 3120341363 79 10
357 3122923980 34 10
358 996174506 15 10
359 11164476478 60 6

View File

@ -1,35 +1,73 @@
id_product,count
2.1.3,14
1.3.1,10
1.3.4,4
1.3.3,4
1.1,3
2.1.3.7,3
1.3.1.3,3
2.1.1,3
2.3,2
2.1.3.4,2
2.1.1.5,2
2.3.1,2
1.3.3.3,2
1.3.3.4,1
2.1.2.2,1
1.1.3,1
2.2,1
2.1.4.1.1,1
2.1.4.1,1
1.3.1.1,1
1.3.1.4,1
2.1.3.2,1
1.3.1.5,1
2.1.2,1
1.3.4.2,1
1.3.1.7,1
2.1.1.4,1
2,1
1.4.5.6,1
1.1.1,1
1.4.3.4,1
1.4.3,1
1.3.4.3,1
1.4.5,1
50,9590
54,8910
53,8840
51,8780
52,8160
55,7860
99,6214
95,4398
46,3872
49,3872
47,3872
48,3872
45,3852
44,3852
90,1442
93,1400
94,1390
91,1390
43,732
92,700
39,696
40,686
38,662
41,512
42,472
7,150
11,40
23,40
20,40
69,40
68,40
67,40
15,40
74,40
31,40
27,40
60,36
61,30
72,30
79,30
8,30
9,30
12,30
66,30
63,30
62,30
24,30
37,30
28,30
30,30
18,30
32,30
33,30
34,30
35,30
73,20
97,20
26,20
29,20
36,20
10,20
71,20
19,20
17,20
16,20
25,20
65,20
64,20
13,10
22,10
70,10
59,10

1 id_product count
2 2.1.3 50 14 9590
3 1.3.1 54 10 8910
4 1.3.4 53 4 8840
5 1.3.3 51 4 8780
6 1.1 52 3 8160
7 2.1.3.7 55 3 7860
8 1.3.1.3 99 3 6214
9 2.1.1 95 3 4398
10 2.3 46 2 3872
11 2.1.3.4 49 2 3872
12 2.1.1.5 47 2 3872
13 2.3.1 48 2 3872
14 1.3.3.3 45 2 3852
15 1.3.3.4 44 1 3852
16 2.1.2.2 90 1 1442
17 1.1.3 93 1 1400
18 2.2 94 1 1390
19 2.1.4.1.1 91 1 1390
20 2.1.4.1 43 1 732
21 1.3.1.1 92 1 700
22 1.3.1.4 39 1 696
23 2.1.3.2 40 1 686
24 1.3.1.5 38 1 662
25 2.1.2 41 1 512
26 1.3.4.2 42 1 472
27 1.3.1.7 7 1 150
28 2.1.1.4 11 1 40
29 2 23 1 40
30 1.4.5.6 20 1 40
31 1.1.1 69 1 40
32 1.4.3.4 68 1 40
33 1.4.3 67 1 40
34 1.3.4.3 15 1 40
35 1.4.5 74 1 40
36 31 40
37 27 40
38 60 36
39 61 30
40 72 30
41 79 30
42 8 30
43 9 30
44 12 30
45 66 30
46 63 30
47 62 30
48 24 30
49 37 30
50 28 30
51 30 30
52 18 30
53 32 30
54 33 30
55 34 30
56 35 30
57 73 20
58 97 20
59 26 20
60 29 20
61 36 20
62 10 20
63 71 20
64 19 20
65 17 20
66 16 20
67 25 20
68 65 20
69 64 20
70 13 10
71 22 10
72 70 10
73 59 10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@ -13,7 +13,6 @@ count_dcp = pd.read_csv("output_result/risk/count_dcp.csv",
'up_id_firm': str,
'down_id_firm': str
})
# print(count_dcp)
count_dcp = count_dcp[count_dcp['count'] > 35]
list_firm = count_dcp['up_id_firm'].tolist(
@ -82,7 +81,7 @@ nx.draw(G_firm,
pos,
node_size=node_size,
labels=node_label,
font_size=8,
font_size=6,
width=3,
edge_color=colors,
edge_cmap=cmap,

View File

@ -11,39 +11,44 @@ print(count_prod)
print(count_prod.describe())
# prod_networkx
BomNodes = pd.read_csv('input_data/input_product_data/BomNodes.csv', index_col=0)
BomNodes.set_index('Code', inplace=True)
BomCateNet = pd.read_csv('input_data/input_product_data/BomCateNet.csv', index_col=0)
BomCateNet.fillna(0, inplace=True)
# BomNodes = pd.read_csv('input_data/input_product_data/BomNodes.csv', index_col=0)
# BomNodes.set_index('Code', inplace=True)
# BomCateNet = pd.read_csv('input_data/input_product_data/BomCateNet.csv', index_col=0)
# BomCateNet.fillna(0, inplace=True)
G = nx.from_pandas_adjacency(BomCateNet.T, create_using=nx.MultiDiGraph())
bom_nodes = pd.read_csv('input_data/input_product_data/BomNodes.csv')
bom_nodes['Code'] = bom_nodes['Code'].astype(str)
bom_nodes.set_index('Index', inplace=True)
bom_cate_net = pd.read_csv('input_data/input_product_data/合成结点.csv')
g_bom = nx.from_pandas_edgelist(bom_cate_net, source='UPID', target='ID', create_using=nx.MultiDiGraph())
labels_dict = {}
for code in G.nodes:
node_attr = BomNodes.loc[code].to_dict()
for code in g_bom.nodes:
node_attr = bom_nodes.loc[code].to_dict()
index_list = count_prod[count_prod['id_product'] == code].index.tolist()
index = index_list[0] if len(index_list) == 1 else -1
node_attr['count'] = count_prod['count'].get(index, 0)
node_attr['node_size'] = count_prod['count'].get(index, 0)
node_attr['node_color'] = count_prod['count'].get(index, 0)
labels_dict[code] = node_attr
nx.set_node_attributes(G, labels_dict)
nx.set_node_attributes(g_bom, labels_dict)
# print(labels_dict)
pos = nx.nx_agraph.graphviz_layout(G, prog="twopi", args="")
dict_node_name = nx.get_node_attributes(G, 'Name')
pos = nx.nx_agraph.graphviz_layout(g_bom, prog="twopi", args="")
dict_node_name = nx.get_node_attributes(g_bom, 'Name')
node_labels = {}
for node in nx.nodes(G):
for node in nx.nodes(g_bom):
node_labels[node] = f"{node} {str(dict_node_name[node])}"
# node_labels[node] = f"{str(dict_node_name[node])}"
colors = list(nx.get_node_attributes(G, 'node_color').values())
colors = list(nx.get_node_attributes(g_bom, 'node_color').values())
vmin = min(colors)
vmax = max(colors)
cmap = plt.cm.Blues
fig = plt.figure(figsize=(10, 10), dpi=300)
nx.draw(G,
nx.draw(g_bom,
pos,
node_size=list(nx.get_node_attributes(G, 'node_size').values()),
node_size=list(nx.get_node_attributes(g_bom, 'node_size').values()),
labels=node_labels,
font_size=6,
node_color=colors,
@ -55,7 +60,7 @@ sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=vmin, vmax=vmax))
sm._A = []
position = fig.add_axes([0.01, 0.05, 0.01, 0.3])
cb = plt.colorbar(sm, fraction=0.01, cax=position)
cb.ax.tick_params(labelsize=8)
cb.ax.tick_params(labelsize=3)
cb.outline.set_visible(False)
plt.savefig("output_result\\risk\\count_prod_network")
plt.close()
@ -83,8 +88,10 @@ list_prod = list(set(list_prod))
# init graph bom
BomNodes = pd.read_csv('input_data/input_product_data/BomNodes.csv', index_col=0)
BomNodes.set_index('Code', inplace=True)
BomNodes = pd.read_csv('input_data/input_product_data/BomNodes.csv')
BomNodes.set_index('Index', inplace=True)
BomNodes.loc[13].to_dict()
g_bom = nx.MultiDiGraph()
g_bom.add_nodes_from(list_prod)
@ -116,7 +123,7 @@ node_labels = nx.get_node_attributes(g_bom, 'Name')
# node_labels['1'] = '解决方案'
temp = {}
for key, value in node_labels.items():
temp[key] = key + " " + value
temp[key] = str(key) + " " + value
node_labels = temp
colors = nx.get_edge_attributes(g_bom, "count")
colors = [w for (n1, n2, _), w in colors.items()]
@ -132,7 +139,7 @@ fig = plt.figure(figsize=(6, 10), dpi=300)
# plt.subplots_adjust(right=0.7)
nx.draw(g_bom,
pos_new,
node_size=50,
node_size=25,
labels=node_labels,
font_size=5,
width=1.5,
@ -149,7 +156,7 @@ sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=vmin, vmax=vmax))
sm._A = []
position = fig.add_axes([0.75, 0.1, 0.01, 0.2])
cb = plt.colorbar(sm, fraction=0.01, cax=position)
cb.ax.tick_params(labelsize=8)
cb.ax.tick_params(labelsize=3)
cb.outline.set_visible(False)
plt.savefig("output_result\\risk\\count_dcp_prod_network")
plt.close()

View File

@ -1,3 +1,5 @@
import pickle
from sqlalchemy import text
from orm import engine, connection
import pandas as pd
@ -5,107 +7,101 @@ import networkx as nx
import json
import matplotlib.pyplot as plt
# prep data
# Prepare data
Firm = pd.read_csv("input_data/input_firm_data/Firm_amended.csv")
Firm['Code'] = Firm['Code'].astype('string')
Firm.fillna(0, inplace=True)
BomNodes = pd.read_csv('input_data/input_product_data/BomNodes.csv', index_col=0)
# SQL query
with open('SQL_analysis_risk.sql', 'r') as f:
str_sql = text(f.read())
result = pd.read_sql(sql=str_sql,
con=connection)
result.to_csv('output_result\\risk\\count.csv',
index=False,
encoding='utf-8-sig')
result = pd.read_sql(sql=str_sql, con=connection)
result.to_csv('output_result/risk/count.csv', index=False, encoding='utf-8-sig')
print(result)
# G bom
# G_bom
plt.rcParams['font.sans-serif'] = 'SimHei'
exp_id = 1
G_bom_str = pd.read_sql(
sql=text(f'select g_bom from iiabmdb.without_exp_experiment '
f'where id = {exp_id};'),
con=connection)['g_bom'].tolist()[0]
G_bom_df = pd.read_sql(
sql=text(f'select g_bom from iiabmdb.without_exp_experiment where id = {exp_id};'),
con=connection
)
if G_bom_df.empty:
raise ValueError(f"No g_bom found for exp_id = {exp_id}")
G_bom_str = G_bom_df['g_bom'].tolist()[0]
if G_bom_str is None:
raise ValueError(f"g_bom data is None for exp_id = {exp_id}")
G_bom = nx.adjacency_graph(json.loads(G_bom_str))
pos = nx.nx_agraph.graphviz_layout(G_bom, prog="twopi", args="")
node_labels = nx.get_node_attributes(G_bom, 'Name')
# rename node 1
# node_labels['1'] = '工业互联网'
# node_labels['1.1'] = '工业自动化硬件'
# node_labels['1.4'] = '工业互联网安全管理'
# node_labels['1.2.1'] = '网络互联服务'
# node_labels['1.2.2'] = '标识解析服务'
# node_labels['1.2.3'] = '数据互通服务'
# node_labels['1.3.1'] = '设计研发软件'
# node_labels['1.3.2'] = '采购供应软件'
# node_labels['1.3.3'] = '生产制造软件'
# node_labels['1.3.4'] = '企业运营软件'
# node_labels['1.3.5'] = '仓储物流软件'
plt.figure(figsize=(12, 12), dpi=300)
nx.draw_networkx_nodes(G_bom, pos)
nx.draw_networkx_edges(G_bom, pos)
nx.draw_networkx_labels(G_bom, pos, labels=node_labels, font_size=6)
# plt.show()
plt.savefig(f"output_result\\risk\\g_bom_exp_id_{exp_id}.png")
nx.draw_networkx_labels(G_bom, pos, labels=node_labels, font_size=3)
plt.savefig(f"output_result/risk/g_bom_exp_id_{exp_id}.png")
plt.close()
# G firm
# G_firm
plt.rcParams['font.sans-serif'] = 'SimHei'
sample_id = 1
# G_firm_df = pd.read_sql(
# sql=text(f'select g_firm from iiabmdb.without_exp_sample where id = {sample_id};'),
# con=connection
# )
#
# if G_firm_df.empty:
# raise ValueError(f"No g_firm found for sample_id = {sample_id}")
#
# G_firm_str = G_firm_df['g_firm'].tolist()[0]
# if G_firm_str is None:
# raise ValueError(f"g_firm data is None for sample_id = {sample_id}")
#
# G_firm = nx.adjacency_graph(json.loads(G_firm_str))
G_firm_str = pd.read_sql(
sql=text(f'select g_firm from iiabmdb.without_exp_sample '
f'where id = {exp_id};'),
con=connection)['g_firm'].tolist()[0]
with open("firm_network.pkl", 'rb') as f:
G_firm = pickle.load(f)
print(f"Successfully loaded cached data from firm_network.pkl")
G_firm = nx.adjacency_graph(json.loads(G_firm_str))
pos = nx.nx_agraph.graphviz_layout(G_firm, prog="twopi", args="")
# desensitize
node_label = nx.get_node_attributes(G_firm, 'Revenue_Log')
node_label = {
key: key
for key in node_label.keys()
}
node_label = {key: key for key in node_label.keys()}
node_size = list(nx.get_node_attributes(G_firm, 'Revenue_Log').values())
node_size = list(map(lambda x: x**2, node_size))
edge_label = nx.get_edge_attributes(G_firm, "Product")
edge_label = {(n1, n2): label for (n1, n2, _), label in edge_label.items()}
plt.figure(figsize=(12, 12), dpi=300)
nx.draw(G_firm, pos, node_size=node_size, labels=node_label, font_size=6)
nx.draw(G_firm, pos, node_size=node_size, labels=node_label, font_size=5)
nx.draw_networkx_edge_labels(G_firm, pos, edge_label, font_size=4)
# plt.show()
plt.savefig(f"output_result\\risk\\g_firm_sample_id_{exp_id}_de.png")
plt.savefig(f"output_result/risk/g_firm_sample_id_{sample_id}_de.png")
plt.close()
# count firm product
# Count firm product
count_firm_prod = result.value_counts(subset=['id_firm', 'id_product'])
count_firm_prod.name = 'count'
count_firm_prod = count_firm_prod.to_frame().reset_index()
count_firm_prod.to_csv('output_result\\risk\\count_firm_prod.csv',
index=False,
encoding='utf-8-sig')
count_firm_prod.to_csv('output_result/risk/count_firm_prod.csv', index=False, encoding='utf-8-sig')
print(count_firm_prod)
# count firm
# Count firm
count_firm = count_firm_prod.groupby('id_firm')['count'].sum()
count_firm = count_firm.to_frame().reset_index()
count_firm.sort_values('count', inplace=True, ascending=False)
count_firm.to_csv('output_result\\risk\\count_firm.csv',
index=False,
encoding='utf-8-sig')
count_firm.to_csv('output_result/risk/count_firm.csv', index=False, encoding='utf-8-sig')
print(count_firm)
# count product
# Count product
count_prod = count_firm_prod.groupby('id_product')['count'].sum()
count_prod = count_prod.to_frame().reset_index()
count_prod.sort_values('count', inplace=True, ascending=False)
count_prod.to_csv('output_result\\risk\\count_prod.csv',
index=False,
encoding='utf-8-sig')
count_prod.to_csv('output_result/risk/count_prod.csv', index=False, encoding='utf-8-sig')
print(count_prod)
# DCP disruption causing probability
@ -114,26 +110,34 @@ print(result_disrupt_ts_above_0)
result_dcp = pd.DataFrame(columns=[
's_id', 'up_id_firm', 'up_id_product', 'down_id_firm', 'down_id_product'
])
result_dcp_list = [] # 用列表收集数据避免DataFrame逐行增长的问题
for sid, group in result.groupby('s_id'):
ts_start = max(group['ts'])
while ts_start >= 1:
ts_end = ts_start - 1
while ts_end >= 0:
up = group.loc[group['ts'] == ts_end, ['id_firm', 'id_product']]
down = group.loc[group['ts'] == ts_start,
['id_firm', 'id_product']]
down = group.loc[group['ts'] == ts_start, ['id_firm', 'id_product']]
for _, up_row in up.iterrows():
for _, down_row in down.iterrows():
row = [sid]
row += up_row.tolist()
row += down_row.tolist()
result_dcp.loc[len(result_dcp.index)] = row
result_dcp_list.append([sid] + up_row.tolist() + down_row.tolist())
ts_end -= 1
ts_start -= 1
# 转换为DataFrame
result_dcp = pd.DataFrame(result_dcp_list, columns=[
's_id', 'up_id_firm', 'up_id_product', 'down_id_firm', 'down_id_product'
])
# 统计
count_dcp = result_dcp.value_counts(
subset=['up_id_firm', 'up_id_product', 'down_id_firm', 'down_id_product'])
count_dcp.name = 'count'
count_dcp = count_dcp.to_frame().reset_index()
count_dcp.to_csv('output_result\\risk\\count_dcp.csv',
index=False, encoding='utf-8-sig')
subset=['up_id_firm', 'up_id_product', 'down_id_firm', 'down_id_product']
).reset_index(name='count')
# 保存文件
count_dcp.to_csv('output_result/risk/count_dcp.csv', index=False, encoding='utf-8-sig')
# 输出结果
print(count_dcp)