├── models_grid_search └── tm_14days_full │ └── model.pt ├── LICENSE ├── dataset ├── flight_2003.csv ├── flight_2002.csv ├── confirmed_by_continent.csv ├── flight_1912.csv ├── flight_2001.csv ├── country_info.csv ├── ISO3166_2.2018.03.csv ├── icn_result.csv ├── ICN_arrive_preprocess.csv ├── Overseas_arrival_1912_2003.csv ├── trend_covid_test.csv ├── trend_flu.csv ├── trend_covid-19.csv └── trend_mask.csv ├── README.md ├── test.py ├── main.py ├── utils.py ├── data_loader.py └── covid_aux.py /models_grid_search/tm_14days_full/model.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaist-dmlab/Hi-COVIDNet/HEAD/models_grid_search/tm_14days_full/model.pt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 KAIST Data Mining Lab 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dataset/flight_2003.csv: -------------------------------------------------------------------------------- 1 | 국가,운항_도착,운항_출발,운항_합계,여객_도착,여객_출발,여객_합계 2 | Japan,649,641,1290,29462,28040,57502 3 | China,1027,1128,2155,18830,71721,90551 4 | Taiwan,91,94,185,4212,1846,6058 5 | Mongolia,3,3,6,812,247,1059 6 | Laos,1,0,1,115,0,115 7 | Malaysia,85,82,167,6496,4238,10734 8 | Myanmar,14,14,28,1363,1578,2941 9 | Vietnam,182,172,354,14253,4396,18649 10 | Brunei,3,3,6,65,59,124 11 | Singapore,72,75,147,3573,2005,5578 12 | Indonesia,86,83,169,12663,7396,20059 13 | Cambodia,43,40,83,5640,4966,10606 14 | Thailand,188,181,369,28526,15090,43616 15 | Philippines,330,325,655,51148,22398,73546 16 | Mexico,24,24,48,1574,1196,2770 17 | US,1002,891,1893,58325,43196,101521 18 | Brazil,10,10,20,0,0,0 19 | Chile,0,0,0,0,0,0 20 | Canada,71,69,140,9473,11121,20594 21 | Peru,0,0,0,0,0,0 22 | Netherlands,29,29,58,4347,2051,6398 23 | Norway,9,8,17,0,0,0 24 | Germany,185,177,362,8204,3886,12090 25 | Russia,149,151,300,3451,8832,12283 26 | Luxembourg,12,13,25,0,0,0 27 | Belgium,14,14,28,0,0,0 28 | Sweden,13,13,26,0,0,0 29 | Switzerland,5,4,9,0,0,0 30 | Spain,18,16,34,1155,497,1652 31 | Azerbaijan,15,15,30,0,0,0 32 | United Kingdom,61,59,120,8230,2833,11063 33 | Austria,4,3,7,424,164,588 34 | Uzbekistan,6,6,12,678,821,1499 35 | Italy,46,45,91,1902,370,2272 36 | Czechia,3,2,5,587,234,821 37 | Kazakhstan,14,14,28,1540,1894,3434 38 | Kyrgyzstan,0,0,0,0,0,0 39 | Turkey,12,12,24,305,110,415 40 | Portugal,2,2,4,326,125,451 41 | Poland,6,6,12,828,706,1534 42 | France,44,42,86,9222,2759,11981 43 | Finland,10,10,20,1140,740,1880 44 | Hungary,1,1,2,136,76,212 45 | Guam,88,83,171,7803,4859,12662 46 | New Zealand,7,6,13,1742,803,2545 47 | Saipan,37,36,73,3641,2224,5865 48 | Palau,14,13,27,1043,668,1711 49 | Hawaii,65,62,127,6872,2748,9620 50 | Australia,28,22,50,4497,2380,6877 51 | United Arab Emirates,46,45,91,6935,4340,11275 52 | Qatar,51,51,102,7326,1472,8798 53 | Nepal,11,10,21,1615,1590,3205 54 | Maldives,1,0,1,132,0,132 55 | Sri Lanka,5,5,10,444,954,1398 56 | Ethiopia,21,12,33,1571,674,2245 57 | Egypt,1,0,1,183,0,183 58 | India,11,8,19,1071,784,1855 59 | -------------------------------------------------------------------------------- /dataset/flight_2002.csv: -------------------------------------------------------------------------------- 1 | 국가,운항_도착,운항_출발,운항_합계,여객_도착,여객_출발,여객_합계 2 | Japan,2438,2438,4876,290769,268539,559308 3 | China,2185,2196,4381,167439,180674,348113 4 | Taiwan,497,496,993,57587,68740,126327 5 | Mongolia,57,57,114,9232,10711,19943 6 | Laos,96,94,190,8910,6139,15049 7 | Malaysia,375,373,748,54021,45082,99103 8 | Myanmar,45,45,90,5793,4486,10279 9 | Vietnam,1725,1716,3441,225911,162563,388474 10 | Brunei,16,16,32,1268,1025,2293 11 | Singapore,257,259,516,30254,27922,58176 12 | Indonesia,153,153,306,32897,31395,64292 13 | Cambodia,110,109,219,14559,11311,25870 14 | Thailand,692,685,1377,112465,86045,198510 15 | Philippines,1084,1081,2165,168589,138335,306924 16 | Mexico,39,38,77,4430,4788,9218 17 | US,1097,1076,2173,159398,180146,339544 18 | Brazil,7,8,15,0,0,0 19 | Chile,0,0,0,0,0,0 20 | Canada,103,103,206,22564,28005,50569 21 | Peru,0,0,0,0,0,0 22 | Netherlands,47,48,95,10472,9674,20146 23 | Norway,8,9,17,0,0,0 24 | Germany,219,217,436,30994,25173,56167 25 | Russia,306,305,611,33683,35329,69012 26 | Luxembourg,14,13,27,0,0,0 27 | Belgium,11,12,23,0,0,0 28 | Sweden,10,10,20,0,0,0 29 | Switzerland,4,5,9,0,0,0 30 | Spain,50,50,100,10569,7644,18213 31 | Azerbaijan,12,12,24,0,0,0 32 | United Kingdom,87,88,175,17209,15327,32536 33 | Austria,12,13,25,1964,1835,3799 34 | Uzbekistan,56,54,110,11174,10144,21318 35 | Italy,94,94,188,17540,12767,30307 36 | Czechia,27,28,55,5594,4559,10153 37 | Kazakhstan,36,35,71,4944,5548,10492 38 | Kyrgyzstan,87,87,174,20217,15042,35259 39 | Turkey,8,8,16,1750,1468,3218 40 | Portugal,21,21,42,4704,4104,8808 41 | Poland,79,79,158,23930,19972,43902 42 | France,29,29,58,8625,6501,15126 43 | Finland,13,13,26,2544,2279,4823 44 | Hungary,275,276,551,35046,30181,65227 45 | Guam,57,56,113,13398,14335,27733 46 | New Zealand,169,167,336,20027,17209,37236 47 | Palau,24,25,49,2151,1950,4101 48 | Hawaii,125,124,249,25418,22279,47697 49 | Australia,102,102,204,22313,26720,49033 50 | Saudi Arabia,0,1,1,0,0,0 51 | United Arab Emirates,88,88,176,25138,22554,47692 52 | Israel,15,13,28,2850,2823,5673 53 | Qatar,45,46,91,9808,7242,17050 54 | Nepal,17,17,34,3158,3763,6921 55 | Maldives,12,13,25,1121,1148,2269 56 | Sri Lanka,0,0,0,1294,1628,2922 57 | Ethiopia,21,20,41,2717,2308,5025 58 | Egypt,9,8,17,2238,1627,3865 59 | India,59,58,117,11273,9206,20479 60 | -------------------------------------------------------------------------------- /dataset/confirmed_by_continent.csv: -------------------------------------------------------------------------------- 1 | China,Asia,Europe,America,Africa,Australia,sum,date,date2 2 | 0,2,8,5,0,0,15,3/22/20,20200322 3 | 0,0,6,8,0,0,14,3/23/20,20200323 4 | 0,0,18,4,0,0,22,3/24/20,20200324 5 | 0,4,29,18,0,0,51,3/25/20,20200325 6 | 0,3,25,11,0,0,39,3/26/20,20200326 7 | 0,1,11,7,0,0,19,3/27/20,20200327 8 | 0,4,25,12,0,0,41,3/28/20,20200328 9 | 0,4,23,14,0,0,41,3/29/20,20200329 10 | 0,1,12,16,0,0,29,3/30/20,20200330 11 | 0,2,13,14,0,0,29,3/31/20,20200331 12 | 0,4,14,17,1,0,36,4/1/20,20200401 13 | 0,3,15,18,0,0,36,4/2/20,20200402 14 | 0,3,20,15,0,0,38,4/3/20,20200403 15 | 0,6,18,30,0,0,54,4/4/20,20200404 16 | 0,8,16,16,0,0,40,4/5/20,20200405 17 | 0,0,3,13,0,0,16,4/6/20,20200406 18 | 0,1,3,13,0,0,17,4/7/20,20200407 19 | 0,2,12,10,0,0,24,4/8/20,20200408 20 | 0,0,5,18,0,0,23,4/9/20,20200409 21 | 0,0,2,3,0,0,5,4/10/20,20200410 22 | 0,1,3,8,0,0,12,4/11/20,20200411 23 | 0,2,4,18,0,0,24,4/12/20,20200412 24 | 0,1,3,12,0,0,16,4/13/20,20200413 25 | 0,1,2,9,0,0,12,4/14/20,20200414 26 | 0,2,6,7,0,1,16,4/15/20,20200415 27 | 0,2,2,7,0,0,11,4/16/20,20200416 28 | 0,3,1,10,0,0,14,4/17/20,20200417 29 | 0,1,2,6,0,0,9,4/18/20,20200418 30 | 0,0,2,3,0,0,5,4/19/20,20200419 31 | 0,0,0,7,0,0,7,4/20/20,20200420 32 | 0,1,1,3,0,0,5,4/21/20,20200421 33 | 0,2,2,2,0,0,6,4/22/20,20200422 34 | 1,1,0,2,0,0,4,4/23/20,20200423 35 | 0,0,0,2,0,0,2,4/24/20,20200424 36 | 0,0,1,3,0,0,4,4/25/20,20200425 37 | 0,3,3,3,0,0,9,4/26/20,20200426 38 | 0,2,2,3,0,0,7,4/27/20,20200427 39 | 0,6,4,2,0,0,12,4/28/20,20200428 40 | 1,1,2,1,0,0,5,4/29/20,20200429 41 | 1,1,0,2,0,0,4,4/30/20,20200430 42 | 0,4,1,3,0,0,8,5/1/20,20200501 43 | 0,2,1,3,0,0,6,5/2/20,20200502 44 | 0,4,2,4,0,0,10,5/3/20,20200503 45 | 0,5,0,3,0,0,8,5/4/20,20200504 46 | 0,1,1,1,0,0,3,5/5/20,20200505 47 | 0,2,0,0,0,0,2,5/6/20,20200506 48 | 0,1,0,2,0,0,3,5/7/20,20200507 49 | 0,8,0,3,0,0,11,5/8/20,20200508 50 | 0,1,0,0,0,0,1,5/9/20,20200509 51 | 0,2,1,2,3,0,8,5/10/20,20200510 52 | 0,2,1,2,1,0,6,5/11/20,20200511 53 | 0,1,1,2,1,0,5,5/12/20,20200512 54 | 0,3,0,1,0,0,4,5/13/20,20200513 55 | 0,2,0,1,0,0,3,5/14/20,20200514 56 | 0,3,1,1,0,0,5,5/15/20,20200515 57 | 0,6,1,3,0,0,10,5/16/20,20200516 58 | 0,1,1,5,0,0,7,5/17/20,20200517 59 | 0,6,1,3,0,0,10,5/18/20,20200518 60 | 0,0,0,4,0,0,4,5/19/20,20200519 61 | 0,6,0,2,0,0,8,5/20/20,20200520 62 | 0,1,0,1,0,0,2,5/21/20,20200521 63 | 0,8,0,1,0,0,9,5/22/20,20200522 64 | 0,4,0,0,0,0,4,5/23/20,20200523 65 | 0,3,1,4,0,0,8,5/24/20,20200524 66 | 0,2,0,1,0,0,3,5/25/20,20200525 67 | 0,2,0,1,0,0,3,5/26/20,20200526 68 | 0,1,0,2,0,0,3,5/27/20,20200527 -------------------------------------------------------------------------------- /dataset/flight_1912.csv: -------------------------------------------------------------------------------- 1 | 국가,운항_도착,운항_출발,운항_합계,여객_도착,여객_출발,여객_합계 2 | Japan,"2,569","2,575","5,144","391,791","364,472","756,263" 3 | China,"4,888","4,960","9,848","695,492","742,125","1,437,617" 4 | Taiwan,626,626,"1,252","159,950","163,227","323,177" 5 | Mongolia,70,70,140,"13,616","13,799","27,415" 6 | Laos,124,124,248,"19,588","20,186","39,774" 7 | Malaysia,416,421,837,"93,981","102,596","196,577" 8 | Myanmar,47,47,94,"6,096","7,200","13,296" 9 | Vietnam,"1,959","1,959","3,918","369,038","395,702","764,740" 10 | Brunei,18,18,36,"2,397","2,193","4,590" 11 | Singapore,283,286,569,"69,794","72,744","142,538" 12 | Indonesia,165,165,330,"41,275","41,348","82,623" 13 | Cambodia,101,101,202,"17,246","20,752","37,998" 14 | Thailand,793,793,"1,586","195,362","206,824","402,186" 15 | Philippines,"1,152","1,152","2,304","205,660","229,328","434,988" 16 | Mexico,38,37,75,"4,403","4,785","9,188" 17 | US,"1,250","1,183","2,433","221,093","196,625","417,718" 18 | Brazil,11,9,20,0,0,0 19 | Chile,0,0,0,0,0,0 20 | Canada,109,109,218,"28,269","26,141","54,410" 21 | Peru,0,0,0,0,0,0 22 | Netherlands,49,49,98,"12,886","12,282","25,168" 23 | Norway,10,9,19,0,0,0 24 | Germany,215,213,428,"30,667","30,287","60,954" 25 | Russia,322,322,644,"40,311","33,083","73,394" 26 | Luxembourg,12,12,24,0,0,0 27 | Belgium,14,14,28,0,0,0 28 | Sweden,8,8,16,0,0,0 29 | Switzerland,4,3,7,0,0,0 30 | Spain,56,56,112,"10,955","11,558","22,513" 31 | Azerbaijan,14,14,28,0,0,0 32 | United Kingdom,90,89,179,"18,885","18,710","37,595" 33 | Austria,13,13,26,"2,647","2,520","5,167" 34 | Uzbekistan,63,64,127,"9,180","13,480","22,660" 35 | Italy,110,108,218,"18,464","18,107","36,571" 36 | Czechia,32,31,63,"6,750","6,668","13,418" 37 | Kazakhstan,38,39,77,"5,490","6,906","12,396" 38 | Kyrgyzstan,93,94,187,"21,693","21,826","43,519" 39 | Turkey,9,9,18,"1,979","2,084","4,063" 40 | Portugal,21,21,42,"4,983","4,880","9,863" 41 | Poland,85,84,169,"25,956","25,088","51,044" 42 | France,29,29,58,"7,644","7,305","14,949" 43 | Finland,13,13,26,"2,399","2,427","4,826" 44 | Hungary,325,325,650,"58,872","58,136","117,008" 45 | Guam,48,49,97,"14,046","14,222","28,268" 46 | New Zealand,185,186,371,"30,459","31,110","61,569" 47 | Palau,27,26,53,"2,929","3,133","6,062" 48 | Hawaii,129,128,257,"27,610","29,575","57,185" 49 | Australia,104,104,208,"36,616","31,819","68,435" 50 | Lebanon,2,2,4,338,299,637 51 | United Arab Emirates,94,95,189,"26,567","29,429","55,996" 52 | Israel,13,13,26,"2,404","2,032","4,436" 53 | Qatar,53,53,106,"7,328","8,257","15,585" 54 | Nepal,18,18,36,"3,319","3,725","7,044" 55 | Maldives,13,13,26,"1,370","1,386","2,756" 56 | Sri Lanka,0,0,0,"1,593","1,962","3,555" 57 | Ethiopia,31,22,53,"2,553","2,673","5,226" 58 | Egypt,5,6,11,"1,052","1,537","2,589" 59 | India,62,62,124,"11,880","12,947","24,827" 60 | -------------------------------------------------------------------------------- /dataset/flight_2001.csv: -------------------------------------------------------------------------------- 1 | 국가,운항_도착,운항_출발,운항_합계,여객_도착,여객_출발,여객_합계 2 | Japan,"2,627","2,619","5,246","373,485","411,083","784,568" 3 | China,"4,999","5,069","10,068","758,857","698,470","1,457,327" 4 | Taiwan,651,648,"1,299","171,723","159,315","331,038" 5 | Mongolia,72,71,143,"14,660","15,072","29,732" 6 | Laos,124,124,248,"19,389","19,039","38,428" 7 | Malaysia,483,481,964,"93,596","97,462","191,058" 8 | Myanmar,49,49,98,"7,225","7,840","15,065" 9 | Vietnam,"2,150","2,149","4,299","394,523","414,419","808,942" 10 | Brunei,18,18,36,"1,681","1,752","3,433" 11 | Singapore,282,285,567,"61,252","69,455","130,707" 12 | Indonesia,165,165,330,"41,197","43,594","84,791" 13 | Cambodia,137,137,274,"26,604","27,869","54,473" 14 | Thailand,833,836,"1,669","205,975","209,415","415,390" 15 | Philippines,"1,233","1,232","2,465","221,019","225,255","446,274" 16 | Mexico,36,37,73,"4,542","5,693","10,235" 17 | US,"1,243","1,179","2,422","205,074","227,983","433,057" 18 | Brazil,8,8,16,0,0,0 19 | Chile,0,0,0,0,0,0 20 | Canada,110,112,222,"27,358","28,852","56,210" 21 | Peru,0,0,0,0,0,0 22 | Netherlands,48,47,95,"12,410","12,409","24,819" 23 | Norway,6,6,12,0,0,0 24 | Germany,217,220,437,"33,119","39,123","72,242" 25 | Russia,320,320,640,"37,429","45,046","82,475" 26 | Luxembourg,12,12,24,0,0,0 27 | Belgium,13,12,25,0,0,0 28 | Sweden,5,5,10,0,0,0 29 | Switzerland,3,3,6,0,0,0 30 | Spain,62,62,124,"13,826","13,909","27,735" 31 | Azerbaijan,12,12,24,0,0,0 32 | United Kingdom,90,90,180,"18,359","20,924","39,283" 33 | Austria,14,13,27,"2,382","2,431","4,813" 34 | Uzbekistan,56,57,113,"11,734","13,217","24,951" 35 | Italy,103,105,208,"20,078","20,565","40,643" 36 | Czechia,31,31,62,"6,992","7,400","14,392" 37 | Kazakhstan,40,40,80,"6,113","7,607","13,720" 38 | Kyrgyzstan,91,91,182,"23,317","23,661","46,978" 39 | Turkey,9,9,18,"2,525","2,621","5,146" 40 | Portugal,21,21,42,"4,930","5,494","10,424" 41 | Poland,85,84,169,"25,705","27,591","53,296" 42 | France,31,31,62,"8,681","9,257","17,938" 43 | Finland,13,13,26,"2,809","3,029","5,838" 44 | Hungary,328,331,659,"56,001","57,758","113,759" 45 | Guam,62,62,124,"16,024","19,762","35,786" 46 | New Zealand,187,186,373,"31,587","31,089","62,676" 47 | Palau,27,27,54,"3,087","2,872","5,959" 48 | Hawaii,132,133,265,"27,698","31,075","58,773" 49 | Australia,112,112,224,"32,021","39,616","71,637" 50 | United Arab Emirates,93,92,185,"29,963","32,729","62,692" 51 | Afghanistan,2,0,2,0,0,0 52 | Israel,18,17,35,"2,993","3,537","6,530" 53 | Qatar,51,50,101,"9,142","10,592","19,734" 54 | Nepal,17,17,34,"3,560","3,834","7,394" 55 | Maldives,14,13,27,"1,304","1,153","2,457" 56 | Sri Lanka,0,0,0,"1,698","1,895","3,593" 57 | Ethiopia,29,22,51,"3,009","3,561","6,570" 58 | Egypt,8,9,17,"1,997","2,305","4,302" 59 | India,61,62,123,"12,446","11,992","24,438" 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hi-COVIDNet : Deep Learning Approach to Predict Inbound COVID-19 Patients and Case Study in South Korea 2 | 3 | ## About 4 | Source code and datasets of the paper [Hi-COVIDNet : Deep Learning Approach to Predict Inbound COVID-19 Patients and Case Study in South Korea](https://dl.acm.org/doi/10.1145/3394486.3412864), KDD 2020 (AI for COVID track, Health Day) 5 | 6 | Since the data from Korea Telecom(KT) is not open to the public, if you would like to run the code, please contact KT. We are contacting KT for data release. 7 | 8 | 9 | ## Installation 10 | Requirements 11 | 12 | - Python 3.6 (Recommend Anaconda) 13 | - Ubuntu 16.04.3 LTS 14 | - Pytorch >= 1.2.0 15 | - Numpy >= 1.17.2 16 | 17 | ## Usage 18 | - Download all codes (*\*.py*) and put them in the same folder 19 | - Create "model_grid_search" folder in the same folder 20 | - Create "pickled_ds" folder for dataset and mean_std data 21 | - Open terminal in the same folder 22 | - Run "python data_loader.py" to preprocess and save data in ".pkl" format 23 | ```bash 24 | python data_loader.py -h 25 | usage: data_loader.py [-h] [--output_size O] [--save] 26 | 27 | Hi-covidnet DATALOADER 28 | 29 | optional arguments: 30 | -h, --help show this help message and exit 31 | --output_size O How many days you are predicting(default: 14) 32 | --save Saving pre-processed data 33 | ``` 34 | example usage : 35 | 36 | ```bash 37 | python data_loader.py --output_size 14 38 | data shape is 32 (14, 10) 39 | target_continent shape is (32, 14, 6) target_total shape is (32, 14) 40 | Loading KT roaming data 41 | Loading infection ratio data 42 | Loading passenger flights data 43 | Normalizing continent target 44 | Normalizing total target 45 | ``` 46 | 47 | - Run "python main.py" to train Hi-COVIDNet 48 | ```bash 49 | python main.py -h 50 | usage: main.py [-h] [--epochs N] [--model_path MODEL_PATH] [--gpu_id GPU_ID] 51 | [--lr LR] [--beta BETA] [--hidden_size HIDDEN] 52 | [--output_size OUTPUT] [--is_aux] [--is_tm] 53 | 54 | Hi-covidnet 55 | 56 | optional arguments: 57 | -h, --help show this help message and exit 58 | --epochs N number of epochs to train (default: 100) 59 | --model_path MODEL_PATH 60 | prefix of path of the model 61 | --gpu_id GPU_ID gpu_ids: e.g. 0,1,2,3,4,5 62 | --lr LR learning rate (default: 0.03) 63 | --beta BETA ratio of continent loss and total loss (default: 0.5) 64 | --hidden_size HIDDEN hidden size of LSTM and Transformer(default: 4) e.g. 65 | 2,4,8, ... depending on your dataset 66 | --output_size OUTPUT How many days you are predicting 67 | --is_aux use auxilary data 68 | --is_tm use transformer 69 | ``` 70 | 71 | ## Hyperparameters: 72 | Please check the hyperparameters of Hi-COVIDNet defined in main.py 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 | -------------------------------------------------------------------------------- /dataset/country_info.csv: -------------------------------------------------------------------------------- 1 | Country,country_lib,continent,visit,n_confirmed,iso,population,area 2 | Argentina,Argentina,America,1,5371,AR,42669500,2780400 3 | Australia,Australia,Australia,1,6913,AU,23696900,7692024 4 | Austria,Austria,Europe,1,15752,AT,8527230,83871 5 | Bangladesh,Bangladesh,Asia,0,12425,BD,157486000,147570 6 | Belarus,Belarus,Europe,0,20168,BY,9475100,207600 7 | Belgium,Belgium,Europe,0,51420,BE,11225469,30528 8 | Bolivia,Bolivia,America,1,2081,BO,10027254,1098581 9 | Brazil,Brazil,America,1,135773,BR,203586000,8515767 10 | Canada,Canada,America,1,66201,CA,35540419,9984670 11 | Chile,Chile,America,1,24581,CL,17819054,756102 12 | China,China,Asia,1,83975,CN,1367110000,9640011 13 | Colombia,Colombia,America,1,9456,CO,47907800,1141748 14 | Croatia,Croatia,Europe,1,2125,HR,4267558,56594 15 | Czechia,Czech Republic,Europe,1,8031,CZ,10521600,78865 16 | Denmark,Denmark,Europe,0,10281,DK,5655750,43094 17 | Dominican Republic,Dominican Republic,America,0,9095,DO,10378267,48671 18 | Ecuador,Ecuador,America,0,30298,EC,15888900,276841 19 | Egypt,Egypt,Africa,1,7981,EG,87668100,1002450 20 | Estonia,Estonia,Europe,1,1720,EE,1315819,45227 21 | Finland,Finland,Europe,1,5673,FI,5470437,338424 22 | France,France,Europe,1,174918,FR,66078000,640679 23 | Germany,Germany,Europe,1,169430,DE,80783000,357114 24 | Greece,Greece,Europe,1,2678,GR,10992589,131990 25 | Hungary,Hungary,Europe,1,3178,HU,9879000,93028 26 | India,India,Asia,1,56351,IN,1263930000,3287590 27 | Indonesia,Indonesia,Asia,1,12776,ID,252164800,1904569 28 | Iran,Iran,Asia,1,103135,IR,77966400,1648195 29 | Ireland,Ireland,Europe,1,22385,IE,6378000,70273 30 | Israel,Israel,Asia,0,16381,IL,8268400,20770 31 | Italy,Italy,Europe,1,215858,IT,60769102,301336 32 | Japan,Japan,Asia,1,15477,JP,127080000,377930 33 | "Korea, South",South Korea,Asia,1,10822,KR,50423955,100210 34 | Kuwait,Kuwait,Asia,1,6567,KW,3268431,17818 35 | Malaysia,Malaysia,Asia,1,6467,MY,30430500,330803 36 | Mexico,Mexico,America,1,29616,MX,119713203,1964375 37 | Netherlands,Netherlands,Europe,1,41973,NL,16881000,41850 38 | Norway,Norway,Europe,0,8034,NO,5156450,323802 39 | Pakistan,Pakistan,Asia,1,24644,PK,188410000,881912 40 | Panama,Panama,America,0,7868,PA,3713312,75417 41 | Peru,Peru,America,1,58526,PE,30814175,1285216 42 | Philippines,Philippines,Asia,1,10343,PH,100697400,342353 43 | Poland,Poland,Europe,1,15047,PL,38496000,312679 44 | Portugal,Portugal,Europe,1,26715,PT,10477800,92090 45 | Qatar,Qatar,Asia,1,18890,QA,2269672,11586 46 | Romania,Romania,Europe,0,14499,RO,19942642,238391 47 | Russia,Russia,Europe,1,177160,RU,146233000,17124442 48 | Saudi Arabia,Saudi Arabia,Asia,0,33731,SA,30770375,2149690 49 | Singapore,Singapore,Asia,1,20939,SG,5469700,710 50 | South Africa,South Africa,Africa,1,8232,ZA,54002000,1221037 51 | Spain,Spain,Europe,1,221447,ES,46507760,505992 52 | Sweden,Sweden,Europe,1,24623,SE,9737521,450295 53 | Switzerland,Switzerland,Europe,1,30126,CH,8183800,41284 54 | Thailand,Thailand,Asia,1,3000,TH,64871000,513120 55 | Turkey,Turkey,Asia,1,133721,TR,76667864,783562 56 | Ukraine,Ukraine,Europe,0,13691,UA,42973696,603700 57 | United Arab Emirates,United Arab Emirates,Asia,1,16240,AE,9446000,83600 58 | United Kingdom,United Kingdom,Europe,1,207977,GB,64105654,242900 59 | Uruguay,Uruguay,America,1,684,UY,3404189,181034 60 | US,United States,America,1,1257023,US,319259000,9629091 61 | Vietnam,Vietnam,Asia,1,288,VN,89708900,331212 62 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | import torch 5 | import torch.nn as nn 6 | import torch.nn.functional as F 7 | import torch.optim as optim 8 | import torch.nn.utils as torch_utils 9 | 10 | from tqdm.notebook import tqdm 11 | import pickle 12 | import copy 13 | import pathlib 14 | 15 | import matplotlib.pyplot as plt 16 | from covid_aux import COVID_AUX_Net, train_COVID_AUX_Net, GlobalRNN, train_globalrnn 17 | import os 18 | 19 | os.environ['CUDA_VISIBLE_DEVICES']= '5' 20 | 21 | countries_Korea_inbound = pickle.load(open("pickled_ds/countries_Korea_inbound_window14_google.pkl", "rb")) 22 | test_data_model2 = pickle.load(open("pickled_ds/data_model2_normal_window14_google_test.pkl", "rb")) 23 | test_data_model2 = [test_data_model2] 24 | test_data_AUX = pickle.load(open("pickled_ds/data_AUX_normal_window14_google_test.pkl", "rb")) 25 | test_data_AUX = [test_data_AUX] 26 | test_target_continent = pickle.load(open("pickled_ds/target_continent_normal_window14_google_test.pkl", "rb")) 27 | test_target_continent = np.expand_dims(test_target_continent, axis=0) 28 | test_target_total = pickle.load(open("pickled_ds/target_total_normal_window14_google_test.pkl", "rb")) 29 | test_target_total = np.expand_dims(test_target_total, axis=0) 30 | 31 | root = pathlib.PosixPath("models_grid_search/tm_14days_full") 32 | 33 | model = COVID_AUX_Net(countries_Korea_inbound, feature_len=10, aux_len=3, hidden_size=4, is_tm = True, output_size=14,) 34 | 35 | model_list = [model] 36 | fnames = ["model.pt"] 37 | 38 | for i in range(len(model_list)): 39 | print(i+1,"th model loading") 40 | state = torch.load(root/fnames[i]) 41 | model_list[i].load_state_dict(state) 42 | model_list[i].to(torch.device("cuda")) 43 | model_list[i].eval() 44 | 45 | criterion = nn.MSELoss() 46 | alpha = .5 47 | Valid_Loss, RMSE_Loss = [],[] 48 | continents_ouputs = [] 49 | outputs = [] 50 | models_rmse = [] 51 | 52 | for j in range(len(model_list)): 53 | with torch.no_grad(): 54 | for i in range(len(test_data_model2)): 55 | continent_patients_pred, total_patients_pred = model_list[j](test_data_model2[i], test_data_AUX[i]) 56 | target_continent_i = torch.as_tensor(test_target_continent[i], dtype=torch.float) 57 | target_total_i = torch.as_tensor(test_target_total[i], dtype=torch.float).unsqueeze(0) 58 | target_continent_i[torch.isnan(target_continent_i)] = 0 59 | target_continent_i[torch.isinf(target_continent_i)] = 0 60 | target_total_i[torch.isnan(target_total_i)] = 0 61 | target_total_i[torch.isinf(target_total_i)] = 0 62 | 63 | # continent_patients_pred : (6,14) 64 | loss1 = criterion(continent_patients_pred, target_continent_i.cuda().transpose(1,0).contiguous()) 65 | loss2 = criterion(total_patients_pred, target_total_i.cuda().squeeze()) 66 | 67 | valid_loss = loss1*alpha + loss2*(1-alpha) 68 | Valid_Loss.append(valid_loss.item()) 69 | RMSE_Loss.append(torch.sqrt(loss2)) 70 | 71 | continents_ouputs.append(continent_patients_pred) #(6,14) 72 | outputs.append(total_patients_pred) 73 | 74 | avg_rmse_loss = sum(RMSE_Loss[-len(test_data_model2):])/len(test_data_model2) 75 | print("RMSE is ",avg_rmse_loss.item()) 76 | models_rmse.append(avg_rmse_loss) 77 | 78 | continent_mean, continent_std = pickle.load(open("pickled_ds/target_continent_mean_std_window14.pkl", "rb")) 79 | total_mean, total_std = pickle.load(open("pickled_ds/target_total_mean_std_window14.pkl", "rb")) 80 | 81 | print("The predicted number of imported cases by Hi-COVIDNet daily basis: \n", outputs[0].cpu().numpy()*total_std+total_mean) 82 | print("The true number of imported cases daily basis: \n", test_target_total[0]*total_std+total_mean) 83 | print() 84 | print("The predicted number of continent-wise cases by Hi-COVIDNet: \n", continents_ouputs[0].transpose(1,0).cpu().numpy()*continent_std+continent_mean) 85 | print("The true number of continent-wise: \n", test_target_continent[0]*continent_std+continent_mean) 86 | 87 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | import torch 5 | import torch.nn as nn 6 | import torch.nn.functional as F 7 | import torch.optim as optim 8 | import torch.nn.utils as torch_utils 9 | 10 | import pickle 11 | import copy 12 | import argparse 13 | 14 | from covid_aux import COVID_AUX_Net, train_COVID_AUX_Net, GlobalRNN, train_globalrnn 15 | import os 16 | 17 | 18 | parser = argparse.ArgumentParser(description='Hi-covidnet') 19 | 20 | # basic settings 21 | parser.add_argument('--epochs', type=int, default=100, metavar='N', help='number of epochs to train (default: 100)') 22 | parser.add_argument('--model_path', default='models_grid_search/tm_14days_full/tanh_hid4', type=str, help='prefix of path of the model') 23 | parser.add_argument('--gpu_id', default='0', type=str, help='gpu_ids: e.g. 0,1,2,3,4,5') 24 | 25 | 26 | # basic hyper-parameters 27 | parser.add_argument('--lr', type=float, default=1e-3, metavar='LR', help='learning rate (default: 0.03)') 28 | parser.add_argument('--beta', type=float, default=.5, metavar='BETA', help='ratio of continent loss and total loss (default: 0.5)') 29 | parser.add_argument('--hidden_size', type=int, default=4, metavar='HIDDEN', help='hidden size of LSTM and Transformer(default: 4) e.g. 2,4,8, ... depending on your dataset') 30 | parser.add_argument('--output_size', type=int, default=14, metavar='OUTPUT', help='How many days you are predicting') 31 | parser.add_argument('--is_aux', action='store_true', default=False, help='use auxilary data') 32 | parser.add_argument('--is_tm', action='store_true', default=False, help='use transformer') 33 | 34 | def main(): 35 | global opts 36 | opts = parser.parse_args() 37 | 38 | # set gpu 39 | os.environ['CUDA_VISIBLE_DEVICES']= opts.gpu_id 40 | 41 | # set train data 42 | train_data_model2 = pickle.load(open("pickled_ds/data_model2_normal_window14_google.pkl", "rb")) 43 | train_data_AUX = pickle.load(open("pickled_ds/data_AUX_normal_window14_google.pkl", "rb")) 44 | train_target_continent = pickle.load(open("pickled_ds/target_continent_normal_window14_google.pkl", "rb")) 45 | train_target_total = pickle.load(open("pickled_ds/target_total_normal_window14_google.pkl", "rb")) 46 | countries_Korea_inbound = pickle.load(open("pickled_ds/countries_Korea_inbound_window14_google.pkl", "rb")) 47 | print("trainset loaded") 48 | 49 | # set test data 50 | test_data_model2 = pickle.load(open("pickled_ds/data_model2_normal_window14_google_test.pkl", "rb")) 51 | test_data_model2 = [test_data_model2] 52 | test_data_AUX = pickle.load(open("pickled_ds/data_AUX_normal_window14_google_test.pkl", "rb")) 53 | test_data_AUX = [test_data_AUX] 54 | test_target_continent = pickle.load(open("pickled_ds/target_continent_normal_window14_google_test.pkl", "rb")) 55 | test_target_continent = np.expand_dims(test_target_continent, axis=0) 56 | test_target_total = pickle.load(open("pickled_ds/target_total_normal_window14_google_test.pkl", "rb")) 57 | test_target_total = np.expand_dims(test_target_total, axis=0) 58 | print("testset loaded") 59 | 60 | feature_len = train_data_model2[0]['Argentina'].shape[1] # It's possible to use any other countries 61 | aux_len = train_data_AUX[0]['Argentina'].shape[0] # It's possible to use any other countries 62 | 63 | best_models = {} 64 | for i in range(20): 65 | print("######" ,i,"th training start", "######") 66 | model = COVID_AUX_Net(countries_Korea_inbound, 67 | feature_len=feature_len, 68 | aux_len=aux_len, 69 | hidden_size=opts.hidden_size, 70 | is_tm = opts.is_tm, 71 | output_size=opts.output_size) 72 | 73 | loss, val_loss, rmse_loss = train_COVID_AUX_Net(model, 74 | train_data_model2, 75 | train_data_AUX,train_target_continent, 76 | train_target_total, 77 | test_data_model2, 78 | test_data_AUX, 79 | test_target_continent, 80 | test_target_total, 81 | num_epoch=opts.epochs, 82 | model_name="{}_{}".format(opts.model_path,i), 83 | lr = opts.lr, 84 | beta=opts.beta) 85 | best_models["{}".format(i)] = sum(rmse_loss[-7:])/7 86 | print(best_models) 87 | 88 | if __name__ == '__main__': 89 | main() 90 | -------------------------------------------------------------------------------- /dataset/ISO3166_2.2018.03.csv: -------------------------------------------------------------------------------- 1 | Name,Code 2 | Afghanistan,AF 3 | Aland Islands,AX 4 | Albania,AL 5 | Algeria,DZ 6 | American Samoa,AS 7 | Andorra,AD 8 | Angola,AO 9 | Anguilla,AI 10 | Antarctica,AQ 11 | Antigua and Barbuda,AG 12 | Argentina,AR 13 | Armenia,AM 14 | Aruba,AW 15 | Australia,AU 16 | Austria,AT 17 | Azerbaijan,AZ 18 | Bahamas,BS 19 | Bahrain,BH 20 | Bangladesh,BD 21 | Barbados,BB 22 | Belarus,BY 23 | Belgium,BE 24 | Belize,BZ 25 | Benin,BJ 26 | Bermuda,BM 27 | Bhutan,BT 28 | "Bolivia, Plurinational State of",BO 29 | "Bonaire, Sint Eustatius and Saba",BQ 30 | Bosnia and Herzegovina,BA 31 | Botswana,BW 32 | Bouvet Island,BV 33 | Brazil,BR 34 | British Indian Ocean Territory,IO 35 | Brunei Darussalam,BN 36 | Bulgaria,BG 37 | Burkina Faso,BF 38 | Burundi,BI 39 | Cambodia,KH 40 | Cameroon,CM 41 | Canada,CA 42 | Cape Verde,CV 43 | Cayman Islands,KY 44 | Central African Republic,CF 45 | Chad,TD 46 | Chile,CL 47 | China,CN 48 | Christmas Island,CX 49 | Cocos (Keeling) Islands,CC 50 | Colombia,CO 51 | Comoros,KM 52 | Congo,CG 53 | "Congo, the Democratic Republic of the",CD 54 | Cook Islands,CK 55 | Costa Rica,CR 56 | Cote d'Ivoire,CI 57 | Croatia,HR 58 | Cuba,CU 59 | Curacao,CW 60 | Cyprus,CY 61 | Czech Republic,CZ 62 | Denmark,DK 63 | Djibouti,DJ 64 | Dominica,DM 65 | Dominican Republic,DO 66 | Ecuador,EC 67 | Egypt,EG 68 | El Salvador,SV 69 | Equatorial Guinea,GQ 70 | Eritrea,ER 71 | Estonia,EE 72 | Ethiopia,ET 73 | Falkland Islands (Malvinas),FK 74 | Faroe Islands,FO 75 | Fiji,FJ 76 | Finland,FI 77 | France,FR 78 | French Guiana,GF 79 | French Polynesia,PF 80 | French Southern Territories,TF 81 | Gabon,GA 82 | Gambia,GM 83 | Georgia,GE 84 | Germany,DE 85 | Ghana,GH 86 | Gibraltar,GI 87 | Greece,GR 88 | Greenland,GL 89 | Grenada,GD 90 | Guadeloupe,GP 91 | Guam,GU 92 | Guatemala,GT 93 | Guernsey,GG 94 | Guinea,GN 95 | Guinea-Bissau,GW 96 | Guyana,GY 97 | Haiti,HT 98 | Heard Island and McDonald Islands,HM 99 | Holy See (Vatican City State),VA 100 | Honduras,HN 101 | Hong Kong,HK 102 | Hungary,HU 103 | Iceland,IS 104 | India,IN 105 | Indonesia,ID 106 | "Iran, Islamic Republic of",IR 107 | Iraq,IQ 108 | Ireland,IE 109 | Isle of Man,IM 110 | Israel,IL 111 | Italy,IT 112 | Jamaica,JM 113 | Japan,JP 114 | Jersey,JE 115 | Jordan,JO 116 | Kazakhstan,KZ 117 | Kenya,KE 118 | Kiribati,KI 119 | "Korea, Democratic People's Republic of",KP 120 | "Korea, Republic of",KR 121 | Kuwait,KW 122 | Kyrgyzstan,KG 123 | Lao People's Democratic Republic,LA 124 | Latvia,LV 125 | Lebanon,LB 126 | Lesotho,LS 127 | Liberia,LR 128 | Libya,LY 129 | Liechtenstein,LI 130 | Lithuania,LT 131 | Luxembourg,LU 132 | Macao,MO 133 | "Macedonia, the Former Yugoslav Republic of",MK 134 | Madagascar,MG 135 | Malawi,MW 136 | Malaysia,MY 137 | Maldives,MV 138 | Mali,ML 139 | Malta,MT 140 | Marshall Islands,MH 141 | Martinique,MQ 142 | Mauritania,MR 143 | Mauritius,MU 144 | Mayotte,YT 145 | Mexico,MX 146 | "Micronesia, Federated States of",FM 147 | "Moldova, Republic of",MD 148 | Monaco,MC 149 | Mongolia,MN 150 | Montenegro,ME 151 | Montserrat,MS 152 | Morocco,MA 153 | Mozambique,MZ 154 | Myanmar,MM 155 | Namibia,NA 156 | Nauru,NR 157 | Nepal,NP 158 | Netherlands,NL 159 | New Caledonia,NC 160 | New Zealand,NZ 161 | Nicaragua,NI 162 | Niger,NE 163 | Nigeria,NG 164 | Niue,NU 165 | Norfolk Island,NF 166 | Northern Mariana Islands,MP 167 | Norway,NO 168 | Oman,OM 169 | Pakistan,PK 170 | Palau,PW 171 | "Palestine, State of",PS 172 | Panama,PA 173 | Papua New Guinea,PG 174 | Paraguay,PY 175 | Peru,PE 176 | Philippines,PH 177 | Pitcairn,PN 178 | Poland,PL 179 | Portugal,PT 180 | Puerto Rico,PR 181 | Qatar,QA 182 | Réunion,RE 183 | Romania,RO 184 | Russian Federation,RU 185 | Rwanda,RW 186 | Saint Barthelemy,BL 187 | "Saint Helena, Ascension and Tristan da Cunha",SH 188 | Saint Kitts and Nevis,KN 189 | Saint Lucia,LC 190 | Saint Martin (French part),MF 191 | Saint Pierre and Miquelon,PM 192 | Saint Vincent and the Grenadines,VC 193 | Samoa,WS 194 | San Marino,SM 195 | Sao Tome and Principe,ST 196 | Saudi Arabia,SA 197 | Senegal,SN 198 | Serbia,RS 199 | Seychelles,SC 200 | Sierra Leone,SL 201 | Singapore,SG 202 | Sint Maarten (Dutch part),SX 203 | Slovakia,SK 204 | Slovenia,SI 205 | Solomon Islands,SB 206 | Somalia,SO 207 | South Africa,ZA 208 | South Georgia and the South Sandwich Islands,GS 209 | South Sudan,SS 210 | Spain,ES 211 | Sri Lanka,LK 212 | Sudan,SD 213 | Suriname,SR 214 | Svalbard and Jan Mayen,SJ 215 | Swaziland,SZ 216 | Sweden,SE 217 | Switzerland,CH 218 | Syrian Arab Republic,SY 219 | "Taiwan, Province of China",TW 220 | Tajikistan,TJ 221 | "Tanzania, United Republic of",TZ 222 | Thailand,TH 223 | Timor-Leste,TL 224 | Togo,TG 225 | Tokelau,TK 226 | Tonga,TO 227 | Trinidad and Tobago,TT 228 | Tunisia,TN 229 | Turkey,TR 230 | Turkmenistan,TM 231 | Turks and Caicos Islands,TC 232 | Tuvalu,TV 233 | Uganda,UG 234 | Ukraine,UA 235 | United Arab Emirates,AE 236 | United Kingdom,GB 237 | United States,US 238 | United States Minor Outlying Islands,UM 239 | Uruguay,UY 240 | Uzbekistan,UZ 241 | Vanuatu,VU 242 | "Venezuela, Bolivarian Republic of",VE 243 | Viet Nam,VN 244 | "Virgin Islands, British",VG 245 | "Virgin Islands, U.S.",VI 246 | Wallis and Futuna,WF 247 | Western Sahara,EH 248 | Yemen,YE 249 | Zambia,ZM 250 | Zimbabwe,ZW 251 | -------------------------------------------------------------------------------- /dataset/icn_result.csv: -------------------------------------------------------------------------------- 1 | ,3/22/20,3/23/20,3/24/20,3/25/20,3/26/20,3/27/20,3/28/20,3/29/20,3/30/20,3/31/20,4/1/20,4/2/20,4/3/20,4/4/20,4/5/20,4/6/20,4/7/20,4/8/20,4/9/20,4/10/20,4/11/20,4/12/20,4/13/20,4/14/20,4/15/20,4/16/20,4/17/20,4/18/20,4/19/20,4/20/20,4/21/20,4/22/20,4/23/20,4/24/20,4/25/20,4/26/20,4/27/20,4/28/20,4/29/20,4/30/20,5/1/20,5/2/20,5/3/20,5/4/20,5/5/20,5/6/20,5/7/20,5/8/20,5/9/20,5/10/20,5/11/20,5/12/20,5/13/20,5/14/20,5/15/20,5/16/20,5/17/20,5/18/20,5/19/20 2 | Argentina,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | Australia,0,0,0,0,0,0,0,1,1,1,0,0,2,1,1,1,0,0,1,1,2,2,2,1,1,1,2,2,0,0,0,1,0,1,0,0,0,0,0,0,1,3,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0 4 | Austria,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | Bolivia,0,0,0,0,0,0,0,0,0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0,1,1,1,1,1 46 | United Kingdom,1,2,1,2,1,3,1,3,2,1,2,1,3,0,2,0,2,1,2,0,1,1,0,0,0,1,0,0,2,0,0,1,1,1,0,2,0,0,0,1,0,0,1,0,0,0,2,0,0,1,0,0,0,2,0,0,1,1,1 47 | Uruguay,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 48 | US,10,11,9,9,10,8,11,8,11,8,7,8,8,9,8,6,8,7,7,7,8,8,5,6,7,7,6,7,8,5,9,6,9,8,9,8,7,9,8,9,8,9,9,8,12,10,9,10,9,9,8,10,9,10,10,11,10,9,11 49 | Vietnam,1,0,3,2,3,2,2,9,5,3,7,3,1,4,2,4,4,2,3,1,1,1,1,3,1,3,4,1,1,2,3,3,2,3,1,1,2,2,3,1,3,0,1,2,2,2,2,4,0,1,2,2,2,2,3,3,8,9,10 50 | -------------------------------------------------------------------------------- /dataset/ICN_arrive_preprocess.csv: -------------------------------------------------------------------------------- 1 | Country,3/22/20,3/23/20,3/24/20,3/25/20,3/26/20,3/27/20,3/28/20,3/29/20,3/30/20,3/31/20,4/1/20,4/2/20,4/3/20,4/4/20,4/5/20,4/6/20,4/7/20,4/8/20,4/9/20,4/10/20,4/11/20,4/12/20,4/13/20,4/14/20,4/15/20,4/16/20,4/17/20,4/18/20,4/19/20,4/20/20,4/21/20,4/22/20,4/23/20,4/24/20,4/25/20,4/26/20,4/27/20,4/28/20,4/29/20,4/30/20,5/1/20,5/2/20,5/3/20,5/4/20,5/5/20,5/6/20,5/7/20,5/8/20,5/9/20,5/10/20,5/11/20,5/12/20,5/13/20,5/14/20,5/15/20,5/16/20,5/17/20,5/18/20,5/19/20 2 | Argentina,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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2,1,2,1,2,2,1,2,1,1,1,2,2,2,2,1,1,1,2,2,1,2,1,1,2,2,2,1,2,1,1,2,2 44 | Turkey,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 45 | United Arab Emirates,1,0,2,0,0,0,0,0,1,0,1,0,2,0,2,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,1,1,1,1,2,0,1,0,0,1,0,1,0,1,0,0,1,0,1,1,1,1,1 46 | United Kingdom,1,2,1,2,1,3,1,3,2,1,2,1,3,0,2,0,2,1,2,0,1,1,0,0,0,1,0,0,2,0,0,1,1,1,0,2,0,0,0,1,0,0,1,0,0,0,2,0,0,1,0,0,0,2,0,0,1,1,1 47 | Uruguay,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 48 | US,10,11,9,9,10,8,11,8,11,8,7,8,8,9,8,6,8,7,7,7,8,8,5,6,7,7,6,7,8,5,9,6,9,8,9,8,7,9,8,9,8,9,9,8,12,10,9,10,9,9,8,10,9,10,10,11,10,9,11 49 | Vietnam,1,0,3,2,3,2,2,9,5,3,7,3,1,4,2,4,4,2,3,1,1,1,1,3,1,3,4,1,1,2,3,3,2,3,1,1,2,2,3,1,3,0,1,2,2,2,2,4,0,1,2,2,2,2,3,3,8,9,10 50 | -------------------------------------------------------------------------------- /dataset/Overseas_arrival_1912_2003.csv: -------------------------------------------------------------------------------- 1 | 국적,목적,201912,202001,202002,202003 2 | Asia,관광,1084718,897879,417316,19227 3 | Asia,상용,10203,9593,4224,602 4 | Asia,공용,2470,1389,1031,120 5 | Asia,유학연수,20048,17488,35548,12663 6 | Asia,기타,116785,137660,79481,17709 7 | Japan,관광,248793,194840,205007,6478 8 | Japan,상용,1738,2804,1162,282 9 | Japan,공용,166,141,64,16 10 | Japan,유학연수,769,1035,1536,868 11 | Japan,기타,3890,5149,3430,703 12 | Japan,관광,3697,2391,2061,555 13 | Japan,상용,2183,2094,972,42 14 | Japan,공용,88,56,19,5 15 | Japan,유학연수,100,166,284,92 16 | Japan,기타,4140,4542,2503,893 17 | Vietnam,관광,18158,18058,9197,941 18 | Vietnam,상용,1136,747,626,15 19 | Vietnam,공용,295,54,49,5 20 | Vietnam,유학연수,4005,3122,9647,2200 21 | Vietnam,기타,7127,8251,10794,887 22 | Myanmar,관광,1964,1273,1271,741 23 | Myanmar,상용,8,9,7,0 24 | Myanmar,공용,40,47,19,0 25 | Myanmar,유학연수,70,98,186,109 26 | Myanmar,기타,4818,4227,2836,1669 27 | Mongolia,관광,8531,10081,5210,191 28 | Mongolia,상용,65,83,42,5 29 | Mongolia,공용,299,359,264,9 30 | Mongolia,유학연수,535,840,427,357 31 | Mongolia,기타,612,960,456,112 32 | Sri Lanka,관광,211,119,146,20 33 | Sri Lanka,상용,47,26,26,1 34 | Sri Lanka,공용,2,2,0,0 35 | Sri Lanka,유학연수,7,27,37,19 36 | Sri Lanka,기타,1046,1203,879,401 37 | Pakistan,관광,404,229,221,70 38 | Pakistan,상용,166,166,150,44 39 | Pakistan,공용,20,23,22,5 40 | Pakistan,유학연수,81,181,236,138 41 | Pakistan,기타,488,415,408,217 42 | Bangladesh,관광,289,189,115,77 43 | Bangladesh,상용,148,110,85,8 44 | Bangladesh,공용,94,19,25,1 45 | Bangladesh,유학연수,52,95,149,133 46 | Bangladesh,기타,1014,886,622,347 47 | China,관광,504215,459173,69889,5213 48 | China,상용,4000,2864,739,119 49 | China,공용,685,107,13,2 50 | China,유학연수,13469,10604,21037,7439 51 | China,기타,58259,75895,33374,4084 52 | Taiwan,관광,88881,108623,51881,274 53 | Taiwan,상용,79,95,52,6 54 | Taiwan,공용,13,20,11,1 55 | Taiwan,유학연수,267,285,393,125 56 | Taiwan,기타,1139,1331,705,179 57 | Philippines,관광,28484,15002,12730,2048 58 | Philippines,상용,117,155,69,13 59 | Philippines,공용,106,169,89,33 60 | Philippines,유학연수,69,211,177,67 61 | Philippines,기타,14505,15165,7267,2378 62 | Thailand,관광,49231,31232,25382,1059 63 | Thailand,상용,53,44,32,21 64 | Thailand,공용,224,110,200,11 65 | Thailand,유학연수,119,126,185,124 66 | Thailand,기타,6223,6954,5978,1156 67 | Malaysia,관광,55329,24541,15459,289 68 | Malaysia,상용,119,101,68,4 69 | Malaysia,공용,3,1,8,1 70 | Malaysia,유학연수,89,139,430,102 71 | Malaysia,기타,2224,2767,2576,494 72 | Singapore,관광,40707,9157,4592,159 73 | Singapore,상용,112,80,49,5 74 | Singapore,공용,13,7,3,6 75 | Singapore,유학연수,76,54,132,13 76 | Singapore,기타,1308,1440,1133,36 77 | Indonesia,관광,23216,14336,12155,1030 78 | Indonesia,상용,126,98,47,6 79 | Indonesia,공용,216,46,80,7 80 | Indonesia,유학연수,117,231,374,373 81 | Indonesia,기타,6041,4732,3144,2344 82 | Asia etc,관광,12608,8635,2000,82 83 | Asia etc,상용,106,117,98,31 84 | Asia etc,공용,206,228,165,18 85 | Asia etc,유학연수,223,274,318,504 86 | Asia etc,기타,3951,3743,3376,1809 87 | Middle East,관광,10050,8929,5980,492 88 | Middle East,상용,988,897,1158,92 89 | Middle East,공용,79,31,17,5 90 | Middle East,유학연수,436,1007,1696,445 91 | Middle East,기타,4890,6356,5998,1052 92 | Uzbekistan,관광,2341,2025,2074,89 93 | Uzbekistan,상용,532,474,700,19 94 | Uzbekistan,공용,7,7,0,0 95 | Uzbekistan,유학연수,252,625,1141,260 96 | Uzbekistan,기타,2329,3004,2973,414 97 | Turkey,관광,1322,952,520,114 98 | Turkey,상용,13,20,11,2 99 | Turkey,공용,37,8,8,0 100 | Turkey,유학연수,26,33,98,21 101 | Turkey,기타,1107,1195,1147,105 102 | Israel,관광,788,723,329,61 103 | Israel,상용,9,13,4,2 104 | Israel,공용,2,2,1,0 105 | Israel,유학연수,5,5,8,3 106 | Israel,기타,35,60,10,2 107 | Iran,관광,114,57,35,9 108 | Iran,상용,69,44,25,1 109 | Iran,공용,5,1,1,1 110 | Iran,유학연수,20,20,56,12 111 | Iran,기타,45,54,43,11 112 | Kazakhstan,관광,2415,2815,1773,144 113 | Kazakhstan,상용,8,21,13,4 114 | Kazakhstan,공용,2,5,2,1 115 | Kazakhstan,유학연수,57,130,171,95 116 | Kazakhstan,기타,906,1354,1245,323 117 | Jordan,관광,91,75,69,13 118 | Jordan,상용,56,51,50,6 119 | Jordan,공용,5,1,0,0 120 | Jordan,유학연수,3,7,14,4 121 | Jordan,기타,38,46,35,22 122 | Saudi Arabia,관광,548,778,200,10 123 | Saudi Arabia,상용,28,43,28,4 124 | Saudi Arabia,공용,10,5,2,1 125 | Saudi Arabia,유학연수,34,94,59,13 126 | Saudi Arabia,기타,39,137,29,1 127 | Iraq,관광,84,58,54,5 128 | Iraq,상용,96,83,70,18 129 | Iraq,공용,1,0,0,0 130 | Iraq,유학연수,3,8,8,2 131 | Iraq,기타,4,7,10,1 132 | Middle East etc,관광,2347,1446,926,47 133 | Middle East etc,상용,177,148,257,36 134 | Middle East etc,공용,10,2,3,2 135 | Middle East etc,유학연수,36,85,141,35 136 | Middle East etc,기타,387,499,506,173 137 | Americas,관광,75502,57337,35781,5513 138 | Americas,상용,431,580,246,57 139 | Americas,공용,3503,3818,2253,621 140 | Americas,유학연수,537,543,1380,190 141 | Americas,기타,19511,25214,17157,7729 142 | US,관광,58743,43866,26407,3995 143 | US,상용,365,495,219,47 144 | US,공용,3436,3712,2200,598 145 | US,유학연수,355,286,848,79 146 | US,기타,14488,18896,12765,5851 147 | Ecuador,관광,134,59,113,24 148 | Ecuador,상용,0,0,0,0 149 | Ecuador,공용,0,1,2,0 150 | Ecuador,유학연수,8,19,21,10 151 | Ecuador,기타,35,38,31,5 152 | Cuba,관광,3,1,8,1 153 | Cuba,상용,0,0,0,0 154 | Cuba,공용,1,0,0,0 155 | Cuba,유학연수,3,3,3,1 156 | Cuba,기타,3,6,3,3 157 | Canada,관광,11377,8793,5834,1022 158 | Canada,상용,38,52,16,3 159 | Canada,공용,30,33,22,9 160 | Canada,유학연수,49,41,109,21 161 | Canada,기타,3798,4890,3065,1350 162 | Brazil,관광,1561,1310,769,107 163 | Brazil,상용,13,15,6,3 164 | Brazil,공용,8,13,3,4 165 | Brazil,유학연수,22,35,71,18 166 | Brazil,기타,329,428,339,159 167 | Mexico,관광,1852,1478,878,150 168 | Mexico,상용,6,7,1,1 169 | Mexico,공용,1,15,4,2 170 | Mexico,유학연수,62,65,135,26 171 | Mexico,기타,461,548,525,209 172 | Chile,관광,217,331,413,41 173 | Chile,상용,2,2,1,0 174 | Chile,공용,2,0,0,0 175 | Chile,유학연수,5,9,16,2 176 | Chile,기타,64,41,65,6 177 | Argentina,관광,290,357,290,32 178 | Argentina,상용,0,0,1,0 179 | Argentina,공용,1,0,1,0 180 | Argentina,유학연수,1,4,14,0 181 | Argentina,기타,43,61,51,39 182 | Colombia,관광,438,293,216,34 183 | Colombia,상용,0,1,0,1 184 | Colombia,공용,11,8,2,4 185 | Colombia,유학연수,13,24,39,10 186 | Colombia,기타,47,50,48,24 187 | Peru,관광,258,276,253,38 188 | Peru,상용,2,1,0,1 189 | Peru,공용,5,10,6,0 190 | Peru,유학연수,6,17,39,8 191 | Peru,기타,26,23,12,6 192 | Venezuela,관광,60,56,80,10 193 | Venezuela,상용,1,1,0,0 194 | Venezuela,공용,0,4,0,0 195 | Venezuela,유학연수,1,6,7,1 196 | Venezuela,기타,65,91,99,24 197 | Americas etc,관광,569,517,520,59 198 | Americas etc,상용,4,6,2,1 199 | Americas etc,공용,8,22,13,4 200 | Americas etc,유학연수,12,34,78,14 201 | Americas etc,기타,152,142,154,53 202 | Europe,관광,53526,49810,36379,5657 203 | Europe,상용,934,1481,748,274 204 | Europe,공용,175,301,117,63 205 | Europe,유학연수,1374,1304,2911,750 206 | Europe,기타,17504,20285,15090,6342 207 | Russia,관광,18951,20746,15487,2189 208 | Russia,상용,172,192,155,42 209 | Russia,공용,22,42,10,4 210 | Russia,유학연수,107,139,288,115 211 | Russia,기타,7318,7772,6217,2950 212 | Poland,관광,789,734,559,134 213 | Poland,상용,12,18,12,12 214 | Poland,공용,0,4,0,0 215 | Poland,유학연수,21,23,52,12 216 | Poland,기타,585,779,583,164 217 | Denmark,관광,583,484,500,91 218 | Denmark,상용,11,19,7,0 219 | Denmark,공용,5,18,5,2 220 | Denmark,유학연수,25,15,54,10 221 | Denmark,기타,158,129,74,11 222 | Greece,관광,476,379,463,129 223 | Greece,상용,18,37,14,4 224 | Greece,공용,0,8,0,2 225 | Greece,유학연수,1,0,4,5 226 | Greece,기타,259,199,182,59 227 | Switzerland,관광,896,614,432,60 228 | Switzerland,상용,14,25,11,4 229 | Switzerland,공용,4,4,2,0 230 | Switzerland,유학연수,18,20,62,14 231 | Switzerland,기타,82,99,59,27 232 | Norway,관광,557,437,354,53 233 | Norway,상용,22,29,10,4 234 | Norway,공용,1,6,0,1 235 | Norway,유학연수,30,23,54,19 236 | Norway,기타,53,48,23,20 237 | Spain,관광,1425,1121,750,127 238 | Spain,상용,12,42,4,6 239 | Spain,공용,17,26,8,5 240 | Spain,유학연수,68,65,111,26 241 | Spain,기타,211,306,195,91 242 | Romania,관광,349,372,228,86 243 | Romania,상용,8,17,5,3 244 | Romania,공용,1,7,1,2 245 | Romania,유학연수,3,10,18,6 246 | Romania,기타,413,450,219,76 247 | Belgium,관광,570,471,343,62 248 | Belgium,상용,11,27,8,6 249 | Belgium,공용,3,3,3,2 250 | Belgium,유학연수,29,23,35,8 251 | Belgium,기타,141,198,158,86 252 | Germany,관광,5714,4648,3725,611 253 | Germany,상용,139,239,133,41 254 | Germany,공용,21,34,19,8 255 | Germany,유학연수,265,205,491,121 256 | Germany,기타,1165,1491,1231,414 257 | United Kingdom,관광,7356,6811,3936,550 258 | United Kingdom,상용,103,186,68,26 259 | United Kingdom,공용,16,22,15,9 260 | United Kingdom,유학연수,47,72,123,44 261 | United Kingdom,기타,1213,2026,1424,544 262 | France,관광,5202,3951,3355,528 263 | France,상용,203,303,123,62 264 | France,공용,34,53,27,19 265 | France,유학연수,426,392,907,184 266 | France,기타,887,1283,708,424 267 | Netherlands,관광,1802,1560,1076,156 268 | Netherlands,상용,23,30,16,5 269 | Netherlands,공용,8,9,2,0 270 | Netherlands,유학연수,100,69,158,29 271 | Netherlands,기타,526,888,815,407 272 | Ukraine,관광,600,493,653,214 273 | Ukraine,상용,60,78,80,30 274 | Ukraine,공용,3,8,3,2 275 | Ukraine,유학연수,8,33,52,7 276 | Ukraine,기타,1509,1343,830,377 277 | Italy,관광,2299,2006,1045,73 278 | Italy,상용,52,138,38,13 279 | Italy,공용,9,26,4,2 280 | Italy,유학연수,39,55,77,18 281 | Italy,기타,685,655,554,142 282 | Bulgaria,관광,173,132,126,40 283 | Bulgaria,상용,1,4,0,0 284 | Bulgaria,공용,3,2,2,0 285 | Bulgaria,유학연수,4,13,6,8 286 | Bulgaria,기타,261,200,84,32 287 | Sweden,관광,1105,696,491,115 288 | Sweden,상용,18,33,14,4 289 | Sweden,공용,9,5,2,1 290 | Sweden,유학연수,62,12,83,38 291 | Sweden,기타,96,101,60,30 292 | Europe etc,관광,4679,4155,2856,439 293 | Europe etc,상용,55,64,50,12 294 | Europe etc,공용,19,24,14,4 295 | Europe etc,유학연수,121,135,336,86 296 | Europe etc,기타,1942,2318,1674,488 297 | Oceania,관광,21567,15046,7053,469 298 | Oceania,상용,83,96,53,18 299 | Oceania,공용,39,38,22,9 300 | Oceania,유학연수,45,34,92,16 301 | Oceania,기타,2162,2541,1672,573 302 | Australia,관광,17818,12320,5689,363 303 | Australia,상용,67,86,44,15 304 | Australia,공용,25,19,15,3 305 | Australia,유학연수,42,26,82,12 306 | Australia,기타,1337,1588,1027,367 307 | New Zealand,관광,3595,2638,1288,90 308 | New Zealand,상용,14,10,5,3 309 | New Zealand,공용,10,15,4,4 310 | New Zealand,유학연수,3,7,5,4 311 | New Zealand,기타,733,883,610,174 312 | Kiribati,관광,19,5,18,6 313 | Kiribati,공용,0,0,0,0 314 | Kiribati,유학연수,0,0,0,0 315 | Kiribati,기타,63,32,20,27 316 | Fiji,관광,55,30,19,1 317 | Fiji,공용,1,3,0,0 318 | Fiji,유학연수,0,1,2,0 319 | Fiji,기타,15,15,9,2 320 | Oceania etc,관광,80,53,39,9 321 | Oceania etc,상용,2,0,4,0 322 | Oceania etc,공용,3,1,3,2 323 | Oceania etc,유학연수,0,0,3,0 324 | Oceania etc,기타,14,23,6,3 325 | Africa,관광,1938,1453,1441,132 326 | Africa,상용,647,502,526,134 327 | Africa,공용,66,71,59,6 328 | Africa,유학연수,96,216,437,145 329 | Africa,기타,1253,1956,1697,766 330 | South Africa,관광,665,509,328,29 331 | South Africa,상용,3,10,7,0 332 | South Africa,공용,0,3,1,0 333 | South Africa,유학연수,3,7,6,0 334 | South Africa,기타,251,743,662,208 335 | Nigeria,관광,79,30,78,10 336 | Nigeria,상용,41,49,71,26 337 | Nigeria,공용,6,8,9,1 338 | Nigeria,유학연수,12,14,45,13 339 | Nigeria,기타,59,57,50,33 340 | Egypt,관광,168,112,87,19 341 | Egypt,상용,120,95,86,15 342 | Egypt,공용,9,2,3,0 343 | Egypt,유학연수,4,16,25,6 344 | Egypt,기타,138,137,114,63 345 | Africa etc,관광,1026,802,948,74 346 | Africa etc,상용,483,348,362,93 347 | Africa etc,공용,51,58,46,5 348 | Africa etc,유학연수,77,179,361,126 349 | Africa etc,기타,805,1019,871,462 350 | -------------------------------------------------------------------------------- /dataset/trend_covid_test.csv: -------------------------------------------------------------------------------- 1 | ,AR,AU,AT,BO,BR,CA,CL,CN,CO,HR,CZ,EG,EE,FI,FR,DE,GR,HU,IN,ID,IR,IE,IT,JP,KR,KW,MY,MX,NL,PK,PE,PH,PL,PT,QA,RU,SG,ZA,ES,SE,CH,TH,TR,AE,GB,UY,US,VN,date 2 | 0,0,8,0,0,0,2,8,0,0,0,9,0,0,0,3,14,0,33,1,0,0,0,0,0,0,0,6,0,0,0,0,7,8,0,0,0,0,0,0,11,0,17,0,0,1,0,2,0,20200301 3 | 1,0,6,14,0,0,4,0,40,0,0,0,0,0,0,4,9,42,0,2,3,0,0,0,0,0,0,5,11,0,0,0,0,0,0,0,0,19,4,0,0,16,0,6,0,1,0,3,0,20200302 4 | 2,0,5,0,0,0,3,0,0,0,0,8,0,0,0,5,8,34,0,6,0,0,0,1,0,38,0,5,0,18,0,0,3,0,0,0,0,19,0,2,20,0,19,6,4,2,0,2,10,20200303 5 | 3,0,7,0,0,0,3,0,0,0,0,8,0,0,0,4,5,0,0,8,3,0,5,2,47,38,47,5,0,0,0,0,0,0,0,0,0,18,0,2,0,16,19,0,7,1,0,3,10,20200304 6 | 4,0,9,0,0,19,5,0,0,0,0,9,0,0,0,4,10,0,0,3,0,0,0,2,0,38,48,4,0,0,13,19,3,0,0,24,0,13,4,2,0,16,19,0,0,2,0,4,0,20200305 7 | 5,0,8,15,0,20,6,0,0,0,0,8,0,0,0,4,7,36,0,5,0,53,5,2,49,0,0,8,0,18,0,0,0,0,0,0,0,27,12,3,16,17,20,0,4,2,0,6,10,20200306 8 | 6,0,13,0,0,24,5,0,0,0,0,0,0,0,0,4,11,0,0,5,3,0,11,3,0,44,0,10,13,21,14,0,10,0,0,24,0,13,4,5,0,0,0,0,5,3,0,6,32,20200307 9 | 7,0,21,35,0,0,4,8,0,22,0,0,0,0,0,2,9,36,0,5,0,0,11,3,48,0,0,6,13,39,0,0,10,8,0,23,0,15,5,5,11,20,0,0,7,2,0,5,11,20200308 10 | 8,0,17,14,0,0,8,0,0,0,0,0,0,0,51,5,15,32,0,6,0,0,14,6,46,38,0,10,0,18,0,0,13,7,0,23,0,28,7,4,10,15,19,6,4,6,0,8,0,20200309 11 | 9,0,21,28,0,0,11,7,0,0,0,15,0,0,51,5,26,33,0,9,6,47,12,6,0,0,0,20,0,0,13,0,19,7,0,23,0,29,0,5,16,0,28,6,7,6,0,10,13,20200310 12 | 10,0,20,21,0,18,26,13,0,17,34,8,0,0,0,8,27,33,0,15,0,0,19,5,0,38,0,19,0,17,19,18,25,7,27,43,0,37,4,6,19,16,37,6,9,9,0,15,22,20200311 13 | 11,0,34,29,0,27,62,0,0,51,0,21,49,0,0,15,32,33,66,15,3,49,17,5,47,58,49,31,10,17,25,0,34,18,27,43,27,28,6,21,14,48,28,6,6,16,0,35,10,20200312 14 | 12,0,63,44,0,26,74,7,0,0,32,21,0,0,0,22,65,52,0,22,9,49,15,3,48,40,53,39,18,24,21,19,37,16,43,38,0,35,10,15,10,30,90,9,9,17,0,43,24,20200313 15 | 13,0,46,25,0,24,69,8,0,22,38,9,52,0,59,27,49,38,36,24,10,0,41,5,74,67,75,14,0,41,19,23,44,19,34,24,32,73,10,17,46,57,64,11,15,13,32,40,10,20200314 16 | 14,0,60,71,0,0,70,16,0,24,0,13,51,55,56,26,48,55,33,21,10,47,33,6,50,65,51,29,19,37,36,24,44,12,32,44,31,76,23,11,27,38,45,6,14,14,34,45,21,20200315 17 | 15,5,78,28,0,18,90,23,36,37,0,7,0,43,96,20,51,66,31,33,12,47,68,7,47,74,0,29,25,53,19,0,55,15,27,22,40,68,35,16,35,44,49,18,17,24,0,50,19,20200316 18 | 16,15,75,56,0,37,100,23,34,35,49,16,48,0,50,26,50,51,0,38,16,0,92,13,0,61,47,46,14,30,21,21,26,16,54,22,27,31,35,19,38,47,51,11,12,26,0,54,22,20200317 19 | 17,12,76,37,0,69,91,13,0,51,64,21,73,0,50,25,49,69,60,40,18,0,75,13,0,37,0,58,28,65,22,20,54,13,26,22,0,69,33,27,19,90,87,26,14,32,39,59,21,20200318 20 | 18,15,52,61,43,29,90,19,0,25,33,19,96,48,0,25,54,70,62,35,51,0,69,9,48,36,100,54,55,64,47,20,34,9,26,0,27,44,33,27,40,44,84,27,28,26,26,62,27,20200319 21 | 19,10,71,45,0,31,95,12,0,51,0,16,0,0,50,37,68,56,46,41,56,0,86,11,49,38,49,29,38,51,35,29,29,32,34,25,0,72,31,22,19,37,99,52,20,23,26,58,32,20200320 22 | 20,18,100,39,0,22,90,11,49,100,37,14,49,0,98,50,54,37,64,62,60,0,75,8,49,44,49,35,61,41,48,29,39,25,31,23,32,58,32,42,19,69,38,43,14,22,47,62,20,20200321 23 | 21,18,84,54,51,81,93,31,0,85,0,12,46,0,58,62,54,33,40,83,97,0,93,12,49,43,0,33,31,50,35,57,64,25,32,21,32,66,26,35,33,89,75,39,22,30,31,64,10,20200322 24 | 22,29,85,51,0,40,97,36,0,0,56,7,41,0,47,55,65,41,34,100,83,47,100,7,47,35,0,40,44,48,62,34,40,25,32,79,0,91,35,28,27,83,38,34,27,26,0,68,22,20200323 25 | 23,43,100,55,0,62,96,54,33,24,31,15,43,48,0,51,64,71,71,94,72,48,76,12,48,72,96,38,66,46,69,38,41,38,26,21,27,80,35,23,22,61,56,22,25,23,25,64,37,20200324 26 | 24,19,93,35,0,46,90,67,0,32,31,18,42,46,0,52,65,65,42,81,62,48,83,8,49,37,0,36,64,53,38,19,44,21,39,36,54,73,38,27,38,41,89,39,18,48,50,63,19,20200325 27 | 25,12,100,42,0,33,83,35,0,32,42,13,83,0,100,67,67,40,29,74,56,48,57,9,66,37,0,41,39,53,52,50,53,15,44,29,28,82,31,37,29,79,91,50,28,36,25,65,41,20200326 28 | 26,16,83,35,0,67,77,39,34,46,30,20,79,0,47,73,75,29,58,84,53,47,40,12,47,37,0,37,78,56,58,27,42,31,50,46,0,64,74,33,28,47,72,85,24,46,24,60,35,20200327 29 | 27,20,77,17,0,66,94,25,49,47,72,25,42,0,57,66,67,49,34,85,71,0,35,11,49,87,71,45,77,45,72,20,45,37,48,68,32,84,60,36,33,71,42,100,27,43,29,67,41,20200328 30 | 28,10,80,39,0,33,73,25,49,31,0,16,65,54,56,61,59,51,32,77,45,0,50,13,47,44,93,17,63,93,50,36,60,29,40,0,0,66,30,33,44,71,53,45,34,40,0,61,32,20200329 31 | 29,15,76,39,0,52,80,27,0,24,31,26,43,0,47,58,66,30,27,64,40,0,49,13,92,72,0,25,53,38,100,29,69,23,25,22,0,62,30,25,37,34,100,69,21,38,0,69,28,20200330 32 | 30,9,58,27,43,39,70,19,0,40,30,18,87,0,0,59,75,30,37,63,58,47,49,14,0,36,47,30,42,50,55,42,33,18,50,21,26,83,40,24,22,56,93,60,40,42,48,67,100,20200331 33 | 31,29,68,42,0,58,64,30,0,16,61,22,42,0,94,69,45,48,42,52,54,100,44,18,47,55,0,21,60,50,31,34,27,28,63,21,81,56,51,35,28,52,81,60,27,41,0,69,81,20200401 34 | 32,13,60,29,43,30,66,16,34,41,0,16,43,44,47,77,47,44,100,51,42,48,46,22,94,36,46,23,82,44,27,29,29,31,54,21,26,50,25,30,40,48,44,46,14,54,24,72,64,20200402 35 | 33,9,53,45,0,47,61,17,36,43,100,31,0,0,0,66,51,30,76,59,52,0,33,25,0,37,0,22,82,34,43,43,35,23,27,23,41,85,44,24,39,76,32,56,31,33,34,69,81,20200403 36 | 34,16,46,17,0,22,57,24,0,31,37,14,44,0,56,58,73,48,68,57,45,0,31,24,72,0,0,16,58,41,29,39,34,13,0,39,0,66,32,23,22,67,36,52,21,26,0,63,47,20200404 37 | 35,16,55,35,0,69,58,15,0,22,0,14,43,56,0,51,72,32,33,53,43,0,45,21,70,43,0,19,46,52,49,0,17,33,29,50,0,51,100,27,26,39,79,47,37,30,31,63,24,20200405 38 | 36,20,60,29,44,68,59,14,0,36,32,15,0,0,47,59,62,0,57,60,39,44,24,17,0,71,47,24,52,67,14,23,38,19,24,21,23,44,44,31,46,79,49,42,44,29,35,76,42,20200406 39 | 37,17,50,31,90,32,59,26,0,18,34,19,43,0,0,72,79,45,44,61,61,0,26,25,45,52,0,21,43,40,48,23,24,24,26,53,25,84,23,54,53,65,65,31,47,24,41,68,21,20200407 40 | 38,7,56,24,44,35,63,20,48,17,0,8,0,0,0,70,43,93,30,55,53,0,15,46,46,36,97,22,60,64,44,29,21,22,26,44,24,60,16,63,47,82,33,36,32,23,0,66,32,20200408 41 | 39,14,46,48,47,49,68,20,33,40,34,8,42,92,49,52,47,42,0,66,42,0,15,42,46,35,0,26,40,40,71,35,4,30,39,21,50,30,25,40,38,62,50,54,44,25,0,63,25,20200409 42 | 40,23,46,51,0,43,61,23,0,63,36,0,86,55,56,51,59,65,34,58,53,0,35,29,92,0,50,24,34,55,24,63,28,47,39,24,0,47,30,35,19,58,40,37,35,22,47,65,33,20200410 43 | 41,24,35,37,0,43,54,38,0,20,58,10,0,0,58,59,27,37,35,58,46,42,11,17,0,44,49,18,56,28,53,37,30,13,31,23,29,53,12,42,19,28,18,31,44,21,32,56,34,20200411 44 | 42,19,37,0,0,23,55,24,51,21,0,10,43,50,53,43,50,0,51,60,46,0,18,20,45,0,0,18,71,41,30,64,24,21,48,22,0,66,14,40,14,61,38,35,50,20,33,49,12,20200412 45 | 43,29,51,31,0,47,74,18,34,67,35,24,42,0,0,58,56,43,0,57,66,0,34,23,67,35,0,10,75,67,21,30,38,27,25,22,48,42,17,53,38,63,29,32,36,22,33,68,43,20200413 46 | 44,20,61,55,0,69,75,29,34,58,30,26,0,0,0,60,50,97,27,49,65,43,25,37,45,70,0,18,46,38,32,40,52,29,48,0,0,50,19,70,28,68,35,53,39,26,47,71,11,20200414 47 | 45,18,56,29,0,65,64,17,0,25,43,23,41,0,0,43,34,31,0,61,82,0,33,39,45,0,94,16,71,58,14,37,35,20,0,43,24,53,22,52,34,70,34,61,58,29,38,67,16,20200415 48 | 46,16,45,37,45,35,54,29,0,17,33,36,43,0,0,54,45,46,44,74,100,0,32,33,87,33,0,37,92,47,36,15,31,33,31,22,25,52,19,58,47,64,25,59,58,28,25,72,21,20200416 49 | 47,28,49,39,0,49,54,38,0,17,33,19,0,0,0,41,45,36,46,65,88,48,21,36,87,35,50,38,72,35,46,40,40,37,25,24,25,83,21,54,53,22,18,53,51,26,26,69,32,20200417 50 | 48,24,54,61,0,21,52,41,0,38,0,10,0,0,0,36,33,38,68,53,87,86,15,23,0,66,0,25,58,57,47,23,34,43,46,46,0,74,17,45,29,27,30,41,67,21,0,67,42,20200418 51 | 49,13,44,62,0,67,40,19,52,20,0,17,0,0,0,68,27,0,30,64,70,0,20,19,45,40,97,23,44,40,41,37,39,43,44,44,30,37,23,45,37,74,21,55,71,16,31,62,26,20200419 52 | 50,19,45,89,87,87,51,19,0,15,0,20,0,0,94,53,100,0,0,70,85,0,28,18,100,33,0,25,31,22,56,29,30,35,45,33,36,42,19,61,100,70,35,47,62,18,49,79,22,20200420 53 | 51,26,45,71,0,52,51,35,32,73,31,18,46,0,0,49,64,63,44,67,68,0,21,24,86,100,0,15,47,50,28,29,38,55,32,22,49,62,29,68,55,41,44,40,74,25,24,86,16,20200421 54 | 52,16,37,60,0,29,50,22,0,15,33,29,48,0,0,42,60,63,60,59,79,44,33,25,66,34,47,27,29,64,44,54,39,47,36,33,50,67,35,72,43,65,36,35,63,27,25,97,11,20200422 55 | 53,18,41,22,44,52,47,21,0,43,32,47,48,100,0,43,31,48,29,57,73,0,21,34,83,99,0,23,52,61,29,48,51,53,24,0,24,52,21,70,48,41,23,58,58,65,25,87,17,20200423 56 | 54,55,45,39,0,80,46,24,33,15,0,100,100,0,0,45,49,34,0,57,48,0,14,27,0,36,46,29,52,35,25,44,48,43,75,37,77,28,22,81,81,45,27,49,54,98,49,82,22,20200424 57 | 55,16,29,36,48,43,47,28,0,44,0,37,0,0,57,42,32,0,99,61,75,0,19,19,67,44,0,16,52,32,23,35,18,41,30,96,30,64,19,79,65,19,41,33,80,55,29,65,12,20200425 58 | 56,42,49,43,47,22,41,21,0,19,0,42,72,56,55,40,41,37,33,56,43,0,15,24,44,0,47,14,55,40,65,100,16,62,0,69,45,24,18,64,40,18,64,40,80,52,30,55,31,20200426 59 | 57,13,71,42,0,52,50,33,0,14,65,57,48,0,71,56,48,33,43,78,75,43,28,26,43,0,48,24,31,26,42,29,27,32,70,23,51,34,21,88,60,51,18,41,88,56,24,75,22,20200427 60 | 58,20,65,94,45,45,50,19,0,28,0,34,48,0,47,71,34,49,30,70,79,0,48,30,44,0,46,37,55,44,33,38,31,32,40,23,0,44,29,81,82,34,18,32,80,62,23,95,11,20200428 61 | 59,23,50,48,44,82,50,19,34,42,0,39,46,0,0,54,41,65,28,82,76,0,33,32,0,0,0,25,45,45,42,37,42,29,23,22,38,18,28,65,53,54,62,48,85,100,24,100,11,20200429 62 | 60,13,52,42,42,45,54,38,0,20,31,25,44,0,48,44,40,31,46,71,57,0,25,42,39,39,0,33,41,26,53,26,48,35,0,21,25,36,18,67,46,33,47,54,100,77,24,89,0,20200430 63 | 61,25,71,77,0,64,54,16,0,0,38,15,0,0,0,36,24,37,53,52,76,0,29,34,43,0,0,22,35,46,25,56,46,31,28,100,65,32,19,49,48,27,57,40,80,79,31,83,19,20200501 64 | 62,8,62,43,0,63,45,43,0,54,37,36,47,0,55,29,28,58,0,63,37,0,24,33,0,0,0,32,34,42,48,50,41,46,31,49,77,32,29,48,28,42,40,47,76,61,31,70,0,20200502 65 | 63,14,64,66,48,52,59,47,0,20,37,23,47,0,0,39,39,0,32,68,55,0,19,28,44,43,72,31,41,32,45,45,36,41,31,34,0,35,38,54,76,56,32,17,88,66,55,64,0,20200503 66 | 64,24,92,49,0,58,59,40,100,15,53,45,0,0,0,59,59,48,67,65,59,0,25,34,83,74,0,78,77,75,56,27,38,33,35,23,62,36,32,49,45,72,28,22,83,77,39,83,16,20200504 67 | 65,8,79,40,0,62,54,26,0,13,29,21,44,44,46,58,48,31,39,63,60,0,21,57,41,39,0,100,56,77,38,38,35,75,22,32,29,39,22,80,77,99,42,26,77,63,22,85,10,20200505 68 | 66,23,83,59,100,45,46,32,0,29,62,35,45,0,48,62,48,33,38,64,63,0,36,79,41,0,0,76,57,100,66,34,40,39,24,29,67,23,34,89,60,46,37,26,94,59,25,82,10,20200506 69 | 67,18,84,31,40,52,48,59,0,14,67,23,46,47,0,73,43,100,46,67,49,0,34,89,64,52,46,42,45,86,47,35,50,39,41,31,28,34,31,78,68,49,57,31,83,59,52,85,0,20200507 70 | 68,19,69,67,0,68,50,49,0,15,35,26,0,0,0,49,43,35,32,71,70,0,24,84,43,55,48,56,70,48,43,48,45,61,25,50,29,31,25,78,56,90,17,25,71,51,27,84,11,20200508 71 | 69,17,71,38,0,100,38,40,0,18,42,21,0,0,0,63,32,40,37,69,54,0,8,64,43,43,0,47,48,49,48,22,33,43,30,36,34,34,17,56,42,31,40,18,76,43,100,73,12,20200509 72 | 70,28,71,35,0,85,47,45,0,20,50,32,91,0,0,61,35,60,34,60,53,83,27,71,44,0,0,41,53,47,45,48,27,39,31,69,44,35,15,54,38,77,21,23,59,57,34,63,12,20200510 73 | 71,18,72,76,60,47,57,64,32,31,46,39,0,0,46,74,65,55,56,64,80,0,16,78,0,33,0,62,49,32,31,27,59,48,31,30,30,45,32,60,82,84,19,27,91,67,25,91,11,20200511 74 | 72,21,66,79,40,46,62,73,0,29,31,33,0,0,47,97,47,56,28,62,54,0,23,100,64,34,0,81,43,72,41,26,43,100,49,33,100,31,40,87,61,61,18,32,78,64,26,93,14,20200512 75 | 73,19,74,51,0,85,70,75,0,15,66,28,94,0,0,100,36,34,29,69,66,0,14,77,44,34,0,71,48,50,57,18,65,39,71,45,0,34,28,100,28,75,24,25,79,76,26,93,0,20200513 76 | 74,17,70,59,81,91,68,95,0,29,33,46,93,0,51,99,43,58,30,53,81,46,31,76,43,34,48,57,62,79,60,31,72,48,60,34,39,100,38,81,57,100,24,38,67,94,26,94,10,20200514 77 | 75,55,68,45,42,53,51,70,0,31,34,34,48,0,50,79,40,53,46,55,77,0,19,76,64,70,49,49,63,46,91,20,59,70,26,66,27,59,33,90,64,59,29,31,75,70,0,85,21,20200515 78 | 76,100,63,46,68,78,57,75,0,0,40,21,47,0,0,82,26,40,54,65,58,64,24,82,0,44,98,26,52,57,42,43,67,30,0,24,43,57,26,51,63,85,34,37,96,55,33,66,11,20200516 79 | 77,55,51,72,47,44,53,58,0,20,38,32,0,0,54,59,34,81,32,67,60,44,25,67,45,43,98,17,100,52,34,17,77,38,44,47,32,38,19,49,67,87,19,31,89,54,0,65,18,20200517 80 | 78,50,81,100,40,92,46,82,0,30,64,44,70,46,0,94,48,34,30,63,66,0,23,69,43,0,49,33,59,55,52,30,100,40,100,34,26,42,37,49,71,80,32,22,94,99,0,93,15,20200518 81 | 79,27,54,90,40,74,49,100,0,29,61,27,96,46,48,88,31,35,39,70,75,0,29,81,57,0,72,31,61,56,62,31,88,51,25,23,0,43,36,56,57,54,33,23,71,81,26,91,15,20200519 82 | -------------------------------------------------------------------------------- /dataset/trend_flu.csv: -------------------------------------------------------------------------------- 1 | ,AR,AU,AT,BO,BR,CA,CL,CN,CO,HR,CZ,EG,EE,FI,FR,DE,GR,HU,IN,ID,IR,IE,IT,JP,KR,KW,MY,MX,NL,PK,PE,PH,PL,PT,QA,RU,SG,ZA,ES,SE,CH,TH,TR,AE,GB,UY,US,VN,date 2 | 0,44,38,29,63,54,29,35,45,26,0,59,31,50,30,46,75,34,14,18,30,100,57,70,74,58,55,18,48,39,32,20,5,43,61,34,45,50,15,39,47,37,48,12,47,34,0,34,78,20200301 3 | 1,30,42,36,26,25,33,24,51,32,42,57,43,50,42,62,58,33,49,17,56,43,53,72,76,97,56,18,50,49,28,22,4,31,48,69,40,54,17,36,60,50,42,7,46,43,43,45,57,20200302 4 | 2,12,48,30,75,21,32,24,0,20,14,45,45,50,20,54,61,24,60,19,59,65,33,47,62,61,46,18,39,24,17,18,6,31,55,79,53,49,23,38,44,44,42,7,45,45,0,43,86,20200303 5 | 3,26,46,31,24,42,29,30,33,10,14,72,39,25,25,61,56,35,27,28,50,51,41,50,53,34,56,16,31,37,30,14,5,59,50,45,26,32,20,25,59,31,49,11,46,50,0,37,85,20200304 6 | 4,23,34,37,25,32,30,25,34,17,22,42,28,100,36,55,50,34,50,26,49,61,50,70,47,36,37,19,27,34,18,11,6,33,45,36,37,48,39,46,36,27,58,9,53,47,41,38,67,20200305 7 | 5,19,31,70,0,18,35,25,35,17,36,37,43,53,26,41,48,19,33,19,50,71,68,81,40,45,40,17,32,42,23,18,7,15,44,26,40,57,36,24,62,49,33,11,45,40,40,39,41,20200306 8 | 6,28,32,49,33,39,39,30,65,20,34,50,28,61,31,29,45,38,35,19,50,45,50,47,37,51,18,16,26,31,12,25,8,51,29,30,37,41,32,53,32,42,57,14,41,37,0,42,88,20200307 9 | 7,26,33,54,31,57,36,21,43,16,33,39,34,46,30,57,46,39,29,22,84,22,45,82,46,30,72,18,39,42,16,38,10,50,38,59,31,52,35,38,54,74,60,10,52,45,50,38,67,20200308 10 | 8,17,34,45,25,33,42,31,67,31,28,43,37,36,33,55,55,43,28,23,45,42,65,82,55,43,46,21,30,53,10,21,16,51,32,89,45,62,39,49,35,35,57,8,52,51,37,46,53,20200309 11 | 9,34,44,49,33,25,48,44,64,12,43,75,71,49,26,61,40,69,65,25,47,49,78,87,75,59,28,19,25,41,20,21,24,89,66,68,44,51,40,53,52,55,54,11,37,56,0,54,62,20200310 12 | 10,38,45,83,0,46,61,35,0,30,65,62,31,96,37,56,72,63,50,25,45,35,82,100,56,88,37,22,54,81,30,20,20,85,78,63,60,54,41,74,92,67,51,23,64,65,37,64,100,20200311 13 | 11,62,63,96,44,40,100,35,62,40,92,37,53,77,93,85,100,99,100,34,51,65,87,92,70,53,19,25,62,90,39,51,30,100,87,79,79,90,45,100,100,89,65,27,67,84,0,100,65,20200312 14 | 12,72,73,77,41,37,96,54,61,40,41,74,66,42,100,100,89,81,37,41,63,44,79,90,60,54,41,38,72,100,53,36,32,98,82,100,52,87,48,89,88,51,45,26,68,78,65,89,78,20200313 15 | 13,59,64,47,46,47,81,46,82,39,40,83,53,46,40,85,97,78,55,57,81,52,92,85,80,41,78,37,52,80,50,52,38,75,100,65,53,70,47,80,87,100,62,18,66,84,46,70,57,20200314 16 | 14,70,74,79,84,100,72,100,41,48,61,100,66,47,48,70,94,75,48,52,92,56,100,84,37,20,100,52,82,77,41,66,39,60,84,71,51,100,62,92,57,68,53,28,77,88,100,67,73,20200315 17 | 15,82,76,100,42,57,74,84,30,73,53,40,100,57,45,66,77,100,44,51,90,21,67,62,73,51,67,49,100,80,42,42,100,46,49,77,64,94,100,85,73,52,50,21,77,92,42,67,73,20200316 18 | 16,43,76,80,84,42,70,42,67,39,34,33,86,84,51,66,83,45,44,100,91,21,76,98,82,42,47,49,73,74,56,100,44,50,70,88,91,94,80,77,82,92,58,27,79,100,79,62,62,20200317 19 | 17,49,76,64,42,39,68,73,72,44,61,40,83,79,59,68,90,76,52,93,90,55,60,58,90,26,37,75,76,76,74,74,35,50,78,82,71,78,80,56,90,62,85,49,100,81,38,60,60,20200318 20 | 18,64,66,87,100,40,64,87,29,29,56,66,68,33,37,60,84,84,68,71,84,33,60,74,100,34,58,100,44,67,71,67,32,44,49,66,76,89,64,73,65,31,46,100,73,68,0,57,76,20200319 21 | 19,68,74,91,45,57,61,84,29,54,85,38,84,50,42,50,79,71,44,68,92,44,53,76,58,26,58,98,47,70,50,51,30,36,55,73,71,76,62,61,71,40,63,70,67,62,38,52,76,20200320 22 | 20,100,67,89,67,78,69,53,55,100,100,40,67,49,45,69,50,67,32,85,87,30,44,69,92,61,67,88,50,61,69,33,27,45,76,39,96,67,67,83,86,55,87,52,63,58,47,52,64,20200321 23 | 21,29,68,71,54,90,68,92,41,70,58,79,76,49,44,71,60,51,39,77,100,43,52,92,76,100,49,69,56,67,86,43,25,84,63,67,100,82,59,85,93,63,100,47,72,68,47,54,70,20200322 24 | 22,31,62,32,38,49,52,33,37,38,47,26,75,53,29,47,60,47,29,82,84,83,45,60,45,16,55,58,54,44,91,57,27,49,34,73,43,75,74,37,58,46,81,28,70,45,35,45,62,20200323 25 | 23,24,62,39,47,59,49,31,0,26,39,44,68,40,25,42,58,80,25,76,86,43,40,57,60,34,0,49,53,46,86,37,25,51,40,74,66,67,63,37,69,35,36,33,71,42,55,44,50,20200324 26 | 24,34,61,54,58,49,48,39,42,13,59,37,52,32,25,51,64,71,41,55,91,36,39,39,36,51,66,39,42,42,100,25,27,49,40,58,70,80,67,42,47,39,37,23,58,43,73,40,62,20200325 27 | 25,48,56,40,55,40,48,33,28,28,46,37,40,50,27,46,54,33,30,51,78,21,38,46,69,42,46,49,43,38,89,24,26,76,37,24,47,74,60,58,49,30,60,28,63,38,37,44,65,20200326 28 | 26,38,55,82,36,32,42,30,28,13,38,58,56,48,26,44,49,38,38,54,69,49,55,48,56,69,37,40,35,33,68,30,25,60,33,90,62,71,84,56,46,13,37,25,42,43,0,41,74,20200327 29 | 27,19,56,48,61,38,50,16,41,24,46,25,35,71,41,40,43,64,39,57,72,47,47,72,50,60,93,39,29,55,60,34,28,32,38,50,53,80,67,39,45,32,44,27,57,61,43,42,87,20200328 30 | 28,25,54,22,42,51,49,38,100,19,96,35,30,55,29,37,53,53,42,49,68,40,56,54,42,99,46,31,39,46,72,20,20,27,46,61,75,81,48,57,58,52,76,33,50,53,43,48,94,20200329 31 | 29,35,54,51,57,31,36,20,41,15,32,27,26,23,24,47,40,47,46,40,55,34,30,49,65,16,65,28,29,32,55,26,17,27,22,62,56,63,48,25,32,37,29,15,40,34,36,38,63,20200330 32 | 30,31,64,34,0,20,36,9,37,19,39,47,38,56,26,43,32,41,32,35,51,63,37,40,42,50,37,25,33,25,37,22,19,39,22,46,43,36,50,39,38,32,33,26,39,35,35,36,69,20200331 33 | 31,30,100,15,28,22,40,36,0,17,65,36,29,58,18,50,44,32,18,33,45,59,33,40,76,58,18,13,36,13,71,12,14,27,29,30,80,64,41,39,33,52,72,24,35,39,34,37,81,20200401 34 | 32,19,79,56,57,30,38,23,43,29,27,17,26,46,10,22,35,39,44,34,45,84,38,33,79,42,27,21,29,25,37,22,14,34,17,26,49,61,53,36,50,30,28,21,47,40,0,31,93,20200402 35 | 33,18,62,21,29,18,38,32,29,12,63,37,35,30,37,40,35,24,44,29,42,28,37,27,38,78,19,21,31,25,23,13,15,32,49,41,30,61,48,25,33,31,47,17,47,32,0,28,66,20200403 36 | 34,27,57,18,0,21,43,30,81,22,47,37,36,28,41,23,41,19,15,29,41,30,36,41,67,61,57,21,34,38,35,22,13,39,41,57,27,61,46,30,38,38,45,15,41,32,0,34,80,20200404 37 | 35,27,50,49,48,29,41,30,43,23,23,29,26,58,21,27,51,20,14,25,46,33,27,46,24,40,47,27,34,26,34,15,18,21,38,26,54,53,63,32,29,29,54,20,30,31,0,35,76,20200405 38 | 36,22,66,31,42,21,30,30,0,15,47,19,30,38,14,30,34,20,0,23,37,20,20,28,31,49,37,21,27,25,21,8,16,32,20,54,22,36,57,20,32,16,46,17,25,24,0,30,63,20200406 39 | 37,7,57,17,44,16,26,14,27,8,42,35,27,24,12,29,26,16,19,21,35,19,24,34,50,56,35,21,30,23,32,29,17,36,14,0,27,42,43,18,22,20,38,12,29,22,0,26,57,20200407 40 | 38,22,58,17,0,18,27,14,0,12,14,22,18,23,16,35,20,24,13,21,31,55,22,30,27,49,29,18,26,15,24,13,12,27,17,43,18,37,42,27,20,24,23,12,36,23,0,25,51,20200408 41 | 39,11,50,51,30,21,30,18,28,19,14,41,26,48,17,24,34,30,14,23,31,20,25,31,34,16,56,17,16,20,36,10,13,18,28,37,69,56,44,19,21,21,18,16,23,22,0,23,70,20200409 42 | 40,25,40,18,48,26,31,13,0,11,15,30,35,0,24,22,38,18,29,23,34,21,25,22,46,59,39,18,24,20,29,14,23,34,22,35,42,55,38,23,27,20,40,11,38,26,46,24,50,20200410 43 | 41,19,38,52,65,29,31,43,42,11,24,48,31,29,17,34,30,26,25,23,34,28,21,28,41,40,39,21,23,23,22,21,16,29,20,25,43,51,37,33,27,26,38,16,35,23,0,25,75,20200411 44 | 42,17,42,39,0,25,28,22,0,26,48,37,21,26,11,29,30,25,15,22,28,19,28,29,27,19,19,18,24,24,32,27,10,20,24,21,24,57,30,22,22,17,32,16,30,23,0,23,51,20200412 45 | 43,11,36,34,30,14,25,22,28,21,22,20,12,23,11,33,21,15,23,18,35,0,24,45,43,32,19,11,21,11,25,34,11,11,17,27,27,36,31,20,21,20,24,14,20,24,0,21,40,20200413 46 | 44,22,46,15,0,24,20,14,28,12,12,30,14,23,8,21,28,34,12,20,31,19,17,42,30,49,37,13,20,13,28,17,14,25,12,24,27,37,30,24,31,10,20,11,26,16,0,20,65,20200414 47 | 45,15,46,23,0,16,23,32,27,15,14,24,52,23,12,19,26,34,12,17,27,0,20,20,47,55,57,14,14,15,16,17,11,9,26,32,27,30,32,16,31,7,31,8,28,17,37,19,39,20200415 48 | 46,22,43,24,29,17,23,11,27,8,27,13,21,0,15,20,18,21,0,17,29,47,19,31,20,30,0,13,15,15,33,16,8,28,8,16,50,21,34,15,24,20,16,7,32,14,0,19,38,20200416 49 | 47,13,38,25,29,16,22,17,0,9,35,18,22,0,21,12,26,17,13,15,27,43,15,34,36,24,20,10,17,17,25,8,13,33,21,18,23,23,34,21,22,11,24,10,27,16,0,20,46,20200417 50 | 48,18,32,19,31,23,25,17,0,17,48,26,28,30,14,18,23,18,15,15,31,29,21,30,42,61,0,12,12,21,24,10,10,16,17,26,66,29,31,23,10,8,14,13,26,19,0,21,36,20200418 51 | 49,23,39,33,0,20,25,13,0,14,44,27,10,29,18,25,25,20,13,20,26,0,22,40,27,19,0,15,22,17,15,10,11,21,39,48,38,39,33,19,14,12,20,8,24,20,0,21,44,20200419 52 | 50,25,40,15,28,19,18,14,0,5,13,12,38,25,9,22,20,16,12,12,25,48,20,28,54,46,19,13,14,18,15,8,9,6,29,27,41,37,28,27,15,16,22,7,28,14,36,19,37,20200420 53 | 51,14,35,15,0,23,19,26,0,10,33,12,25,26,17,19,24,17,13,18,25,29,14,29,51,46,19,13,20,19,24,11,10,19,18,16,18,32,28,16,20,0,10,3,26,14,54,20,33,20200421 54 | 52,17,37,16,29,18,24,11,27,10,0,13,15,27,9,25,18,32,13,19,24,39,19,28,36,31,38,12,23,11,21,11,9,23,16,32,55,26,29,14,19,20,12,5,26,15,0,21,40,20200422 55 | 53,20,34,32,29,16,21,10,0,14,13,32,20,0,6,9,20,15,13,17,19,20,20,35,25,38,36,12,20,9,19,12,11,19,18,31,31,29,23,19,5,17,29,7,29,14,0,19,35,20200423 56 | 54,18,29,17,30,14,18,16,0,12,0,27,10,27,9,22,23,24,18,15,25,32,17,33,33,17,19,12,19,18,25,8,10,7,8,37,24,17,22,14,12,21,10,7,13,12,37,17,46,20200424 57 | 55,17,31,19,31,12,21,21,0,9,67,0,20,0,15,25,28,24,0,18,27,25,20,18,27,0,19,16,12,11,19,19,8,15,10,27,33,44,42,23,18,8,20,10,27,19,0,16,33,20200425 58 | 56,14,28,18,0,21,21,19,0,13,0,0,30,29,7,17,28,29,14,17,27,0,21,30,33,0,0,10,25,9,17,10,8,18,14,17,33,36,55,23,24,8,6,12,25,18,0,17,49,20200426 59 | 57,18,33,22,29,18,19,18,0,15,14,13,20,0,6,20,17,8,12,17,23,32,15,20,22,16,28,11,25,13,15,16,8,20,23,50,47,16,31,18,13,13,15,7,21,15,35,16,42,20200427 60 | 58,22,34,0,58,15,19,21,0,8,13,13,16,0,15,20,16,25,13,12,19,28,33,45,39,80,0,8,17,15,22,24,10,10,16,25,33,24,30,13,13,6,22,8,22,15,0,17,29,20200428 61 | 59,11,35,36,28,16,18,11,27,10,13,36,19,47,8,22,23,18,21,15,22,36,22,24,23,25,36,17,25,9,25,15,8,16,10,27,14,15,28,23,12,15,17,6,19,16,0,18,34,20200429 62 | 60,15,30,15,26,15,17,10,25,6,13,12,24,0,16,20,20,22,18,15,21,18,18,32,28,45,35,9,19,12,18,14,13,25,13,15,18,24,24,20,9,30,9,7,23,14,0,15,31,20200430 63 | 61,18,30,18,0,22,14,13,0,6,32,29,42,31,8,27,13,26,14,16,24,21,16,22,35,19,19,14,18,11,26,9,10,16,23,28,27,24,19,11,15,41,8,6,26,13,46,14,26,20200501 64 | 62,9,24,24,46,20,16,37,0,6,31,44,13,0,10,21,18,17,14,16,23,24,14,15,16,41,0,20,17,12,11,14,8,24,20,18,31,29,24,17,13,15,16,4,15,12,0,14,41,20200502 65 | 63,15,26,18,31,19,17,13,0,14,16,18,15,0,0,19,27,8,14,18,23,18,15,18,32,39,19,10,17,11,17,20,9,7,0,25,19,31,35,19,15,8,9,2,18,15,0,15,21,20200503 66 | 64,14,26,0,0,15,15,25,0,5,13,24,16,0,12,25,23,17,0,21,22,0,14,18,37,25,46,17,18,18,12,15,11,12,18,22,17,17,21,23,18,22,18,3,21,14,71,14,19,20200504 67 | 65,11,26,42,23,14,14,9,0,9,25,11,18,23,14,21,19,10,23,19,16,26,18,32,37,27,17,12,14,12,13,11,7,14,17,16,32,35,24,11,12,18,19,7,22,13,33,12,33,20200505 68 | 66,7,31,32,0,21,13,15,27,10,40,12,23,24,10,13,22,15,12,17,22,18,16,18,36,23,0,8,17,15,15,10,6,15,13,24,30,18,26,15,11,6,33,7,24,13,0,13,33,20200506 69 | 67,15,29,34,26,20,13,10,0,10,28,27,14,24,9,21,13,8,20,15,21,40,11,28,16,24,28,8,20,13,24,8,7,16,8,25,46,15,31,14,21,10,9,8,12,12,0,12,24,20200507 70 | 68,18,28,18,27,21,14,11,0,5,15,17,19,39,10,13,18,22,14,16,20,22,12,18,32,17,48,6,18,9,26,15,7,14,8,28,16,22,23,10,12,14,10,5,20,13,40,11,25,20200508 71 | 69,34,21,20,0,24,14,24,0,6,18,0,9,33,10,29,9,38,16,14,18,19,19,22,24,30,39,8,15,6,16,14,5,9,10,36,31,20,22,19,11,17,14,5,27,11,0,12,33,20200509 72 | 70,9,25,19,44,17,16,22,0,7,24,14,19,33,7,26,19,14,15,17,20,37,21,38,26,19,19,10,16,13,16,10,5,16,25,17,27,17,32,10,15,16,20,3,19,17,0,12,17,20200510 73 | 71,17,26,25,26,19,13,21,26,13,0,23,22,0,10,14,7,10,25,13,22,36,8,28,34,38,0,7,20,12,13,7,8,15,8,33,0,22,25,12,13,12,13,4,22,14,37,12,34,20200511 74 | 72,13,23,30,0,17,11,26,0,9,13,12,22,24,15,20,13,12,12,14,18,54,9,16,26,46,19,6,17,17,8,10,8,12,18,49,35,20,21,20,10,13,25,6,25,12,0,11,18,20200512 75 | 73,8,25,20,52,13,14,10,26,0,42,24,14,0,6,18,24,8,12,12,16,19,14,20,20,16,0,9,12,10,23,11,6,19,13,51,33,16,30,14,15,6,15,3,13,12,0,12,24,20200513 76 | 74,19,23,16,26,16,12,10,0,5,14,19,25,24,6,15,18,11,13,14,19,20,14,20,16,16,28,8,22,6,11,7,9,13,16,33,14,36,18,9,7,13,10,5,18,12,0,13,41,20200514 77 | 75,8,19,16,41,18,13,16,0,8,14,13,20,25,6,11,12,14,13,12,20,22,11,24,19,24,0,11,7,5,31,7,9,20,11,18,15,17,18,13,13,7,10,3,23,12,0,12,18,20200515 78 | 76,47,19,26,0,23,13,24,44,6,0,26,16,30,14,22,18,10,16,15,22,44,15,18,19,20,19,6,6,15,16,9,13,9,15,36,18,31,18,17,7,16,5,4,22,11,0,12,37,20200516 79 | 77,14,18,0,30,49,15,19,45,11,0,31,28,28,14,21,19,19,28,16,22,19,10,22,20,39,19,10,13,6,17,14,18,23,16,26,36,27,19,9,7,25,11,3,16,13,0,12,40,20200517 80 | 78,20,20,16,26,18,14,30,0,11,20,26,19,0,6,30,12,8,26,14,21,29,15,33,29,31,0,7,21,6,13,10,11,10,11,33,34,20,19,14,7,10,9,10,19,10,41,13,25,20200518 81 | 79,11,19,0,52,15,12,10,0,10,0,26,26,0,6,28,23,8,0,12,29,19,14,7,25,0,28,7,19,7,22,7,9,16,25,17,22,26,17,14,9,7,11,6,18,9,37,11,28,20200519 82 | -------------------------------------------------------------------------------- /dataset/trend_covid-19.csv: -------------------------------------------------------------------------------- 1 | ,AR,AU,AT,BO,BR,CA,CL,CN,CO,HR,CZ,EG,EE,FI,FR,DE,GR,HU,IN,ID,IR,IE,IT,JP,KR,KW,MY,MX,NL,PK,PE,PH,PL,PT,QA,RU,SG,ZA,ES,SE,CH,TH,TR,AE,GB,UY,US,VN,date 2 | 0,3,4,5,6,3,5,3,0,3,0,7,5,14,10,10,8,7,6,0,1,5,13,10,9,26,0,5,5,12,3,2,5,8,4,16,4,24,2,3,8,14,7,2,9,6,0,5,16,20200301 3 | 1,2,7,13,5,3,7,2,22,5,8,14,3,12,12,13,13,5,4,1,4,8,22,10,8,34,17,15,5,14,2,3,6,10,7,17,3,37,3,3,10,23,11,3,10,11,0,9,18,20200302 4 | 2,4,7,6,5,2,7,6,44,3,12,14,13,16,9,12,12,4,6,3,3,13,10,11,11,28,25,15,3,12,3,2,5,9,10,12,4,31,2,6,23,24,13,4,12,12,8,10,24,20200303 5 | 3,2,8,8,4,3,8,5,22,3,12,10,8,12,10,12,12,9,10,4,2,4,14,14,7,29,17,24,2,12,3,1,5,15,10,25,2,37,2,3,21,22,14,5,14,16,8,11,22,20200304 6 | 4,4,8,19,5,3,9,4,45,2,11,9,3,16,17,12,13,10,12,3,1,15,16,17,9,33,13,23,2,13,2,2,9,9,12,13,3,29,9,9,18,24,13,5,10,17,8,13,21,20200305 7 | 5,2,9,10,5,3,11,4,33,9,16,8,6,38,8,15,12,9,11,3,2,7,28,21,9,20,13,26,3,17,7,8,11,12,13,10,3,32,5,7,23,27,14,4,9,18,8,15,29,20200306 8 | 6,4,9,8,0,3,9,4,0,12,9,7,4,20,11,15,11,14,9,2,1,13,11,34,11,15,17,13,2,12,4,7,13,11,11,20,4,36,5,11,14,26,9,5,9,15,9,13,38,20200307 9 | 7,5,8,12,11,4,10,5,29,8,0,12,6,25,21,22,18,13,6,2,1,6,19,42,6,42,25,14,2,17,4,5,13,13,14,25,3,33,4,12,22,39,8,5,20,15,9,14,43,20200308 10 | 8,9,12,15,5,4,15,2,65,9,11,18,6,12,22,25,23,17,17,4,3,14,45,52,11,31,16,27,3,22,4,8,42,21,34,16,3,43,8,20,28,36,10,6,21,25,10,23,50,20200309 11 | 9,7,17,32,9,5,18,5,21,12,24,29,8,43,39,25,20,28,14,5,3,8,36,53,13,23,21,24,5,27,2,9,50,25,40,30,5,56,9,27,34,40,17,14,12,30,7,26,57,20200310 12 | 10,12,20,37,18,7,29,7,43,12,43,37,12,17,53,27,28,60,21,7,4,15,56,57,15,45,25,35,7,27,2,17,50,46,52,25,4,38,14,38,52,34,18,24,24,36,25,37,49,20200311 13 | 11,28,33,55,17,20,63,15,41,26,61,39,5,30,100,50,42,89,22,11,5,11,83,73,16,43,26,45,18,56,8,25,93,72,59,63,21,55,15,71,81,59,20,28,27,56,14,61,64,20200312 14 | 12,33,36,63,23,28,69,16,49,25,53,40,9,100,70,68,59,81,35,16,11,10,67,76,15,58,32,45,27,56,16,19,86,67,72,33,21,55,20,74,74,70,25,34,28,61,56,67,55,20200313 15 | 13,26,34,75,19,23,59,25,41,26,49,33,26,27,63,68,61,72,22,14,12,10,70,67,12,35,22,39,27,68,16,20,71,69,67,43,20,54,17,76,60,62,19,31,29,52,58,58,48,20200314 16 | 14,41,53,79,13,25,72,37,29,31,51,55,36,45,63,71,59,67,43,14,17,10,66,72,12,44,40,57,27,68,8,45,74,63,56,39,19,69,35,77,68,76,22,28,36,63,47,65,44,20200315 17 | 15,40,69,75,25,46,96,60,49,61,42,41,31,36,58,95,62,73,33,19,31,10,82,72,15,43,43,83,37,60,19,48,100,56,65,74,32,79,49,70,93,77,26,43,33,93,34,93,56,20200316 18 | 16,43,71,63,26,61,97,46,48,56,49,32,36,38,63,93,63,57,41,24,31,10,75,68,20,70,43,100,53,61,26,38,81,63,59,77,38,65,41,70,85,61,30,43,36,94,59,91,59,20200317 19 | 17,46,69,82,8,68,100,50,57,60,50,34,26,45,66,87,59,59,32,24,36,11,80,68,19,52,37,83,52,67,24,38,84,49,55,56,25,70,49,70,84,79,34,46,38,87,43,93,69,20200318 20 | 18,52,66,62,30,81,92,40,47,52,47,28,44,36,49,80,55,62,26,27,41,5,79,65,17,53,26,89,56,50,27,45,69,45,57,35,21,78,50,69,61,70,29,40,36,77,24,94,58,20200319 21 | 19,55,66,68,35,84,82,57,20,60,29,39,43,32,52,75,60,54,39,33,43,11,73,68,10,49,35,95,50,45,37,52,63,43,90,41,30,64,61,68,59,73,32,38,24,82,100,93,54,20200320 22 | 20,65,61,47,47,89,76,59,70,74,66,37,66,41,46,72,65,42,17,46,40,8,68,66,15,50,43,90,55,40,43,37,74,37,95,71,27,70,50,70,62,54,26,36,49,69,87,82,42,20200321 23 | 21,58,96,45,21,82,81,55,96,71,56,42,53,56,59,72,65,41,27,45,41,8,64,69,29,46,35,86,55,61,41,36,64,44,100,60,54,66,58,72,64,76,28,38,42,80,41,86,51,20200322 24 | 22,74,89,62,36,81,92,59,100,69,42,34,47,11,45,74,59,68,22,61,53,11,84,70,34,76,49,86,62,50,60,38,81,47,64,47,47,74,77,64,64,85,28,39,49,95,63,100,54,20200323 25 | 23,73,100,50,52,78,84,54,37,64,49,40,38,30,49,75,46,45,24,55,60,10,98,65,29,65,34,81,66,46,46,49,74,46,60,79,49,77,67,62,59,65,27,39,50,92,56,91,61,20200324 26 | 24,62,93,59,35,84,80,60,46,69,52,58,56,23,60,80,62,69,24,65,58,19,100,65,45,89,34,81,72,52,62,44,78,48,57,64,51,79,87,70,60,70,33,49,56,90,60,90,72,20200325 27 | 25,91,91,76,57,89,82,57,65,66,86,87,81,80,68,78,88,91,47,80,80,69,94,88,63,92,63,91,94,90,69,49,80,98,57,91,75,73,86,74,87,100,47,67,73,97,63,99,72,20200326 28 | 26,90,94,100,100,100,80,82,74,90,100,100,76,100,89,100,100,94,65,100,100,97,98,100,100,99,100,93,90,100,100,49,71,100,56,62,100,100,98,98,100,86,81,100,100,100,71,99,100,20200327 29 | 27,72,72,70,69,92,69,86,80,84,57,54,46,52,80,70,68,54,31,75,57,12,71,82,64,57,55,76,88,63,51,48,71,58,40,88,68,69,81,100,74,60,16,47,70,82,50,89,53,20200328 30 | 28,71,76,60,53,86,68,74,81,100,44,51,43,26,66,69,70,42,37,69,51,20,64,64,66,51,79,69,91,65,43,58,63,61,49,77,66,62,100,81,70,62,18,43,63,74,80,85,53,20200329 31 | 29,66,74,82,40,85,69,83,46,80,43,51,44,26,61,71,65,39,24,66,86,9,88,66,65,75,79,66,99,65,54,70,68,57,45,60,61,69,93,84,77,74,30,41,59,82,58,97,60,20200330 32 | 30,71,75,74,65,75,66,81,53,72,54,43,35,22,50,63,58,44,23,72,81,18,86,62,50,67,55,56,100,71,57,64,58,52,40,74,57,75,66,77,71,61,23,34,63,71,57,91,61,20200331 33 | 31,76,70,70,55,75,66,66,38,82,39,43,50,22,44,63,59,47,25,67,78,10,76,62,58,92,69,48,85,59,51,67,51,58,35,83,59,68,64,74,75,61,27,49,56,83,61,94,58,20200401 34 | 32,92,69,76,57,90,66,76,66,82,65,32,36,40,52,69,77,55,23,71,77,37,74,69,75,100,28,53,94,78,49,67,59,63,35,84,67,72,65,76,73,77,32,52,57,81,75,94,39,20200402 35 | 33,100,61,94,45,86,63,70,48,84,32,61,100,51,38,70,90,55,34,73,69,29,68,78,76,78,43,50,85,72,58,64,48,64,38,93,60,75,58,81,69,73,46,47,70,80,82,92,60,20200403 36 | 34,88,54,80,41,80,57,71,55,84,68,67,85,32,39,55,82,46,21,71,49,48,64,61,82,72,56,54,78,61,47,68,46,71,41,69,57,59,56,76,71,55,26,40,75,60,83,83,57,20200404 37 | 35,82,53,73,73,82,55,66,85,83,51,47,82,36,55,54,84,50,26,68,42,30,51,62,61,83,38,56,79,60,52,86,45,60,33,71,50,66,91,78,51,61,32,41,69,66,78,81,56,20200405 38 | 36,88,65,78,66,88,61,73,75,89,75,49,52,33,45,67,80,56,20,68,68,31,65,65,63,71,79,57,88,65,51,83,55,70,34,50,44,84,65,79,60,82,34,39,67,71,62,87,54,20200406 39 | 37,73,61,60,62,80,55,76,97,73,44,42,66,40,43,66,55,46,29,70,70,24,68,64,34,69,69,55,82,60,50,82,47,62,33,63,46,75,55,72,68,55,42,45,71,69,87,79,43,20200407 40 | 38,78,58,46,75,88,53,67,44,78,51,45,55,30,46,59,60,48,32,65,57,39,62,62,36,62,50,55,81,54,47,80,45,65,36,77,40,57,57,72,54,59,35,49,73,62,58,74,47,20200408 41 | 39,86,49,65,97,84,49,72,46,70,76,94,38,49,77,62,53,100,65,72,60,100,58,65,33,61,66,55,79,60,54,100,39,60,43,71,35,73,50,69,55,68,31,48,68,59,49,71,41,20200409 42 | 40,87,41,57,83,86,42,63,58,74,79,95,72,27,71,57,52,79,100,71,42,80,54,58,34,56,70,54,67,48,43,97,40,52,34,99,38,56,50,62,46,46,39,49,59,52,70,68,50,20200410 43 | 41,85,35,51,64,80,42,64,95,81,61,64,52,32,56,57,54,65,54,68,44,58,36,54,32,42,65,46,65,53,52,77,47,43,30,61,38,59,47,69,50,59,100,41,59,48,60,62,41,20200411 44 | 42,59,38,43,45,79,37,53,57,74,42,70,58,41,45,46,56,70,59,72,36,62,43,52,30,45,43,52,65,41,51,75,42,39,24,83,46,65,51,57,47,49,36,42,61,45,45,53,51,20200412 45 | 43,63,44,54,33,93,39,56,66,67,58,48,57,40,64,49,55,65,39,68,48,55,38,56,28,68,76,50,63,52,58,66,43,44,30,82,64,61,53,59,41,41,34,39,67,51,41,62,50,20200413 46 | 44,56,43,58,43,91,39,58,54,62,46,41,63,16,43,56,50,55,17,67,50,27,54,61,32,52,62,43,59,46,40,80,39,61,22,83,60,48,56,52,50,52,39,45,62,51,31,61,44,20200414 47 | 45,65,43,55,43,86,38,59,64,62,31,43,70,33,37,54,53,34,23,67,50,28,54,63,34,38,59,47,55,52,45,78,50,52,21,92,49,48,52,52,63,40,36,40,66,54,28,57,48,20200415 48 | 46,64,45,40,40,88,38,61,80,51,26,35,43,22,39,58,46,40,21,66,43,31,52,66,30,57,67,49,62,56,39,84,38,51,26,100,49,56,76,55,56,59,32,39,63,51,35,57,49,20200416 49 | 47,57,35,46,55,81,38,100,58,54,19,42,57,29,41,60,51,42,18,66,45,34,42,56,27,72,79,45,48,60,47,82,39,51,24,68,44,52,82,52,56,54,34,43,57,49,27,56,50,20200417 50 | 48,55,29,61,47,75,34,57,27,55,36,35,59,24,34,45,51,42,29,67,35,36,45,53,22,30,70,42,47,49,37,72,38,30,21,80,47,54,54,52,37,51,34,39,66,38,41,50,40,20200418 51 | 49,50,33,50,39,80,32,45,29,51,33,28,62,23,35,50,53,48,11,64,30,26,35,51,19,37,39,42,41,43,56,71,36,48,22,83,47,51,44,47,50,50,37,43,58,37,32,48,42,20200419 52 | 50,54,31,48,42,80,35,41,84,43,34,47,47,33,28,52,52,46,22,62,40,30,59,56,23,65,62,48,44,45,43,67,40,50,23,59,43,47,51,50,49,50,34,41,57,46,27,51,41,20200420 53 | 51,53,34,52,51,80,31,49,35,58,25,31,46,37,35,53,52,52,17,63,40,35,36,58,19,34,72,41,52,64,48,64,41,53,20,57,37,49,57,44,47,49,33,39,54,44,29,50,48,20200421 54 | 52,54,34,46,67,82,34,41,27,60,50,31,38,39,34,54,48,60,19,62,39,34,47,54,18,52,43,45,48,46,39,62,36,50,22,36,46,42,61,46,48,50,36,39,44,43,23,51,37,20200422 55 | 53,58,30,47,45,85,32,37,51,52,28,27,39,12,37,48,46,64,13,62,28,31,44,52,21,56,36,44,51,54,37,75,37,59,18,67,39,49,77,44,49,39,35,32,52,47,30,48,46,20200423 56 | 54,51,29,35,46,70,29,35,18,52,33,28,39,30,33,47,52,63,11,68,26,29,35,51,18,67,55,37,50,52,44,75,38,46,18,53,40,47,62,49,50,48,36,35,40,42,37,45,42,20200424 57 | 55,41,26,44,58,69,27,24,58,46,31,25,39,38,27,46,43,48,10,69,27,25,38,46,11,42,43,35,44,47,32,73,29,50,18,81,40,36,41,42,34,44,35,32,54,38,45,42,42,20200425 58 | 56,45,33,63,35,73,28,23,20,49,20,25,36,0,30,49,46,47,20,67,23,29,29,52,16,55,67,36,36,47,42,62,29,32,17,54,31,43,52,42,39,38,34,37,58,35,39,40,43,20200426 59 | 57,43,35,52,62,82,30,29,52,57,33,24,43,23,36,51,43,48,24,69,33,31,42,60,19,74,51,40,46,53,38,67,34,53,16,41,37,51,63,50,49,42,32,30,55,45,22,45,46,20200427 60 | 58,42,32,48,61,85,30,31,34,50,43,32,49,33,48,59,37,61,19,67,34,33,50,52,18,39,50,39,43,44,38,58,33,47,17,57,33,32,76,43,43,49,39,37,51,44,32,46,52,20200428 61 | 59,46,30,33,33,92,29,34,63,52,26,29,39,23,23,54,43,49,14,59,34,21,38,54,17,49,37,32,41,47,41,57,31,43,21,47,42,37,94,45,47,47,31,38,56,43,20,44,42,20200429 62 | 60,47,30,52,42,87,27,34,34,51,29,29,36,15,15,49,35,55,13,66,36,28,32,50,15,35,91,34,37,48,35,55,26,42,21,61,39,38,71,43,43,43,38,32,59,38,33,41,34,20200430 63 | 61,44,30,47,28,90,24,27,93,46,29,31,43,14,32,45,47,50,19,74,27,26,45,48,12,43,13,40,35,43,48,62,32,34,18,54,36,34,65,43,31,39,38,34,55,43,23,40,39,20200501 64 | 62,43,27,57,36,87,22,27,59,51,26,20,47,21,30,50,44,44,19,74,26,27,26,51,12,28,34,37,37,43,45,55,35,35,23,68,42,35,63,37,37,37,40,32,57,33,26,36,37,20200502 65 | 63,44,23,46,52,83,23,32,31,45,18,21,53,28,36,42,43,48,16,78,21,26,31,54,12,39,51,34,33,40,40,52,28,41,27,49,39,31,69,41,39,52,43,31,37,37,36,37,43,20200503 66 | 64,44,30,39,68,89,26,30,41,54,33,18,35,22,30,53,39,52,22,73,29,26,34,58,10,60,50,40,41,38,36,54,35,44,26,83,39,39,88,42,40,57,39,38,52,42,33,41,41,20200504 67 | 65,38,26,56,45,85,23,25,38,48,16,24,41,11,28,51,43,58,15,73,26,32,39,53,9,42,51,37,35,42,51,55,30,37,27,63,38,47,85,45,41,57,37,35,44,41,14,40,46,20200505 68 | 66,45,25,38,48,81,24,28,28,57,17,27,42,19,26,48,41,58,19,73,28,30,34,57,13,49,41,32,37,51,38,57,28,42,26,52,30,31,77,44,41,36,35,36,50,41,18,39,36,20200506 69 | 67,40,25,49,66,85,23,25,54,49,29,23,39,12,23,52,44,49,11,68,24,18,39,49,16,45,38,34,36,48,38,57,31,41,27,38,31,30,79,40,38,41,40,35,50,40,21,39,40,20200507 70 | 68,42,24,38,55,83,22,26,36,42,19,34,38,12,21,48,44,53,14,82,24,32,31,57,14,60,55,33,36,45,46,69,32,35,27,57,31,29,73,40,27,45,37,34,55,38,32,39,37,20200508 71 | 69,40,24,44,65,86,20,25,58,37,30,31,48,15,17,49,43,49,19,89,22,27,22,51,9,44,48,34,29,43,52,55,26,32,20,57,41,31,71,37,27,42,43,23,59,38,37,49,29,20200509 72 | 70,38,26,35,54,80,19,26,59,36,21,24,37,0,20,46,47,46,14,93,19,26,37,49,9,28,53,32,25,44,47,39,24,30,23,52,32,30,69,32,25,46,36,33,59,49,28,41,36,20200510 73 | 71,46,29,34,45,89,24,36,52,46,24,18,49,21,27,51,45,53,15,85,27,36,37,49,14,62,52,37,34,47,39,52,35,37,21,45,49,30,95,45,42,38,40,41,69,63,21,44,39,20200511 74 | 72,42,22,46,47,84,25,32,25,53,27,25,40,19,19,48,45,65,13,83,25,25,44,48,14,51,71,35,31,41,54,53,34,33,19,61,33,31,84,40,41,36,41,43,62,54,28,40,39,20200512 75 | 73,45,24,43,65,81,23,33,35,44,23,16,43,19,25,45,42,35,12,73,27,38,34,53,16,64,42,33,33,40,44,54,34,37,22,70,34,30,97,43,28,37,42,33,55,49,26,41,36,20200513 76 | 74,38,26,35,65,82,21,31,34,49,28,27,52,34,23,41,40,64,13,75,24,30,48,49,12,42,46,38,34,45,52,52,32,30,22,64,40,25,85,36,31,37,36,40,54,49,21,40,38,20200514 77 | 75,43,25,37,20,82,21,29,56,44,13,17,28,12,21,41,43,53,13,74,23,39,29,45,14,59,77,30,29,43,57,61,30,33,21,47,34,27,63,34,33,44,40,34,60,48,27,38,34,20200515 78 | 76,42,19,33,33,84,17,24,59,43,19,27,49,14,27,40,47,55,15,77,22,37,31,44,9,24,81,30,27,42,36,52,29,24,18,57,39,24,58,34,30,37,35,35,49,40,24,35,35,20200516 79 | 77,36,24,46,22,96,17,27,89,47,23,39,37,27,23,41,38,63,18,81,19,31,31,46,12,38,48,27,25,49,29,48,26,31,25,72,41,29,60,34,26,39,40,30,44,40,28,33,35,20200517 80 | 78,40,26,49,44,95,18,28,36,44,20,26,29,17,22,43,44,46,20,74,21,32,32,57,13,49,47,28,32,38,43,50,32,32,20,48,35,35,77,44,34,41,33,30,59,48,39,38,40,20200518 81 | 79,40,24,51,29,84,20,34,35,40,22,23,45,15,19,37,44,50,9,74,24,45,41,55,11,48,25,33,36,52,40,53,36,36,19,46,30,32,73,42,41,29,39,35,61,42,19,36,32,20200519 82 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | from sklearn.preprocessing import StandardScaler 4 | 5 | import pickle 6 | import copy 7 | import os 8 | 9 | def sum_country_regions(df, country): 10 | # Get indices of the countries 11 | country_indices = df.loc[df['Country/Region'] == country].index 12 | columns = df.columns 13 | 14 | has_colony = pd.isna(df.loc[country_indices]).any(axis=1) 15 | if has_colony.any(): 16 | # Case 1: imperialist nations 17 | df.drop(has_colony[-has_colony].index, inplace=True) 18 | return df 19 | else: 20 | # Case 2: federal country 21 | # Get the summation data of the countries 22 | # and replace the first region with the result 23 | 24 | df.loc[country_indices[0], 4:] = df.loc[country_indices].sum(axis=0)[4:] 25 | # Remove the rest regions 26 | df.drop(country_indices[1:], inplace=True) 27 | 28 | return df 29 | 30 | def get_change_rates(series, days): 31 | series_change_rate = copy.deepcopy(series) 32 | for day_index in range(len(series)): 33 | min_day = day_index - days if day_index - days >= 0 else 0 34 | change_rate = 1 + (series[day_index] - series[min_day]) / series[min_day] if int(series[min_day]) is not 0 else 1 35 | series_change_rate[day_index] = change_rate 36 | if change_rate >99: 37 | print(change_rate) 38 | 39 | return series_change_rate 40 | def generate_df_change_rate(df, days): 41 | df_change_rate = df.copy(deep=True) 42 | columns = df.columns 43 | for country in range(len(df)): 44 | df_change_rate.loc[country, columns[4:]] = get_change_rates(df.loc[country, columns[4:]], days)# .apply(lambda x: get_change_rates(x, days)) 45 | 46 | return df_change_rate 47 | 48 | def sliding_window(data, seq_length, normalize=True): 49 | x=[] 50 | y=[] 51 | for i in range(len(data) - seq_length): 52 | x_ = data[i:(i + seq_length)] 53 | y_ = data[i+seq_length] 54 | if normalize: 55 | x_ = [float(_)/y_ for _ in x_] 56 | y_ = y_/float(y_) if y_ is not 0 else 0 57 | x.append(x_) 58 | y.append(y_) 59 | 60 | return x, y 61 | 62 | def generate_sequence(df_confirm, df_death, selected_index=None, selected_country=None, normalize=False, seq_length=14): 63 | # Check whether two data have the same number of countries 64 | assert len(df_confirm) == len(df_death) 65 | 66 | seq_confirm_x, seq_confirm_y = [], [] 67 | seq_death_x, seq_death_y = [], [] 68 | 69 | 70 | # Generate sequence data 71 | # the actual data starts from column index 4 72 | for country in range(len(df_confirm)): 73 | try: df_confirm.loc[country, 'Country/Region'] 74 | except Exception as e: continue 75 | if df_confirm.loc[country, 'Country/Region'] not in selected_country: 76 | continue 77 | seq_confirm_x_tmp, seq_confirm_y_tmp = sliding_window(df_confirm.loc[country][selected_index[country]:], seq_length, normalize) 78 | seq_death_x_tmp, seq_death_y_tmp = sliding_window(df_death.loc[country][selected_index[country]:], seq_length, normalize) 79 | 80 | seq_confirm_x.extend(seq_confirm_x_tmp) 81 | seq_confirm_y.extend(seq_confirm_y_tmp) 82 | 83 | seq_death_x.extend(seq_death_x_tmp) 84 | seq_death_y.extend(seq_death_y_tmp) 85 | 86 | 87 | 88 | seq_death_x = np.expand_dims(np.array(seq_death_x, dtype=np.float), axis=2) 89 | seq_death_y = np.expand_dims(np.array(seq_death_y, dtype=np.float), axis=2) 90 | seq_confirm_x = np.expand_dims(np.array(seq_confirm_x, dtype=np.float), axis=2) 91 | seq_confirm_y = np.expand_dims(np.array(seq_confirm_y, dtype=np.float), axis=2) 92 | 93 | print(seq_death_x.shape) 94 | print(seq_death_y.shape) 95 | print(seq_confirm_x.shape) 96 | print(seq_confirm_y.shape) 97 | 98 | # Merge data to make 2-dim sequence data 99 | X = np.concatenate((seq_confirm_x, seq_death_x), 2) 100 | Y = np.concatenate((seq_confirm_y, seq_death_y), 1) 101 | 102 | print(X.shape) 103 | print(Y.shape) 104 | return X, Y 105 | 106 | 107 | def generate_COVID_input(df_death, 108 | df_death_change_1st_order, 109 | df_death_change_2nd_order, 110 | df_confirm, 111 | df_confirm_change_1st_order, 112 | df_confirm_change_2nd_order, 113 | df_incoming, 114 | google_trend1,google_trend2,google_trend3,google_trend4, 115 | countries_Korea_inbound, 116 | seq_length=14, 117 | end_day = None, 118 | is_7days = False, 119 | scaler_list=None): 120 | 121 | # Filter out unrelated countries & columns from data 122 | selected_country = np.array(countries_Korea_inbound.loc[countries_Korea_inbound.visit.eq(1), 'Country']) 123 | selected_country = np.delete(selected_country, np.argwhere(selected_country == 'Korea, South')) 124 | 125 | 126 | columns = df_death.columns 127 | 128 | select = [] 129 | for country in range(len(df_death)): 130 | select.append(df_death.loc[country, 'Country/Region'] in selected_country) # Indices where the selected countries are 131 | 132 | 133 | s_ = np.where(google_trend1.columns == df_incoming.loc[0, 'date'])[0][0] 134 | 135 | if end_day is None: 136 | e_ = np.where(google_trend1.columns == df_incoming.loc[len(df_incoming)-1, 'date'])[0][0] 137 | else : 138 | e_ = np.where(google_trend1.columns == end_day)[0][0] 139 | 140 | start_day = np.where(columns == df_incoming.loc[0, 'date'])[0][0] 141 | if end_day is None: 142 | end_day = np.where(columns == df_incoming.loc[len(df_incoming)-1, 'date'])[0][0] 143 | else : 144 | end_day = np.where(columns == end_day)[0][0] 145 | # print(start_day,end_day) 146 | selected_country = np.array(df_death.loc[select, 'Country/Region']) 147 | 148 | d1 = df_death.loc[select, columns[start_day:end_day+1]] 149 | d2 = df_death_change_1st_order.loc[select, columns[start_day:end_day+1]] 150 | d3 = df_death_change_2nd_order.loc[select, columns[start_day:end_day+1]] 151 | d4 = df_confirm.loc[select, columns[start_day:end_day+1]] 152 | d5 = df_confirm_change_1st_order.loc[select, columns[start_day:end_day+1]] 153 | d6 = df_confirm_change_2nd_order.loc[select, columns[start_day:end_day+1]] 154 | 155 | d7 = google_trend1.loc[:, google_trend1.columns[s_:e_+1]] 156 | d8 = google_trend2.loc[:, google_trend2.columns[s_:e_+1]] 157 | d9 = google_trend3.loc[:, google_trend3.columns[s_:e_+1]] 158 | d10 = google_trend4.loc[:, google_trend4.columns[s_:e_+1]] 159 | 160 | d1 = np.log(d1+1) 161 | d4 = np.log(d4+1) 162 | 163 | #scaling 164 | mean, std = scaler_list[0] 165 | d4 = d4.subtract(mean[select], axis='index').divide(std[select], axis='index') 166 | 167 | mean, std = scaler_list[1] 168 | d1 = d1.subtract(mean[select], axis='index').divide(std[select], axis='index') 169 | 170 | mean, std = scaler_list[2] 171 | d5 = d5.subtract(mean[select], axis='index').divide(std[select], axis='index') 172 | 173 | mean, std = scaler_list[3] 174 | d6 = d6.subtract(mean[select], axis='index').divide(std[select], axis='index') 175 | 176 | mean, std = scaler_list[4] 177 | d2 = d2.subtract(mean[select], axis='index').divide(std[select], axis='index') 178 | 179 | mean, std = scaler_list[5] 180 | d3 = d3.subtract(mean[select], axis='index').divide(std[select], axis='index') 181 | ## 182 | 183 | # Clean up the refined data 184 | 185 | d1.reset_index(inplace=True, drop=True) 186 | d2.reset_index(inplace=True, drop=True) 187 | d3.reset_index(inplace=True, drop=True) 188 | d4.reset_index(inplace=True, drop=True) 189 | d5.reset_index(inplace=True, drop=True) 190 | d6.reset_index(inplace=True, drop=True) 191 | d7.reset_index(inplace=True, drop=True) 192 | d8.reset_index(inplace=True, drop=True) 193 | d9.reset_index(inplace=True, drop=True) 194 | d10.reset_index(inplace=True, drop=True) 195 | 196 | columns = d1.columns 197 | 198 | 199 | # Generate country-wise 6-dim vectors of 14 days 200 | data = [] 201 | for day in range(end_day - start_day+1 - seq_length): 202 | country_dict = {} 203 | for idx, country in enumerate(selected_country): 204 | _ = np.concatenate(( 205 | np.expand_dims(np.array(d1.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 206 | np.expand_dims(np.array(d2.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 207 | np.expand_dims(np.array(d3.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 208 | np.expand_dims(np.array(d4.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 209 | np.expand_dims(np.array(d5.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 210 | np.expand_dims(np.array(d6.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 211 | np.expand_dims(np.array(d7.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 212 | np.expand_dims(np.array(d8.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 213 | np.expand_dims(np.array(d9.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1), 214 | np.expand_dims(np.array(d10.loc[idx, columns[day:(day+seq_length)]], dtype=np.float), axis=1)), axis=-1) 215 | 216 | country_dict[country] = _ 217 | 218 | data.append(country_dict) 219 | 220 | 221 | target_continent = np.array(df_incoming.loc[:, countries_Korea_inbound.continent.unique()]) 222 | target_total = np.array(df_incoming.loc[:, 'sum']) 223 | 224 | if end_day is not None: 225 | # target_continent : (n,6) -> (N:39, T:14,D:6); target_total : (n,1) -> (N:39, T:14,D:1) 226 | target_continent = [target_continent[day+seq_length:day+seq_length+seq_length//2,:] if is_7days else target_continent[day+seq_length:day+seq_length*2,:] for day in range(end_day - start_day+1 - seq_length)] 227 | target_total = [target_total[day+seq_length:day+seq_length+seq_length//2,] if is_7days else target_total[day+seq_length:day+seq_length*2,] for day in range(end_day - start_day+1 - seq_length)] 228 | 229 | print() 230 | target_continent = np.stack(target_continent,axis=0) 231 | target_total = np.stack(target_total,axis=0) 232 | return data, target_continent, target_total 233 | 234 | else : 235 | return data, target_continent[-(end_day - start_day+1 - seq_length):], target_total[-(end_day - start_day+1 - seq_length):] 236 | 237 | 238 | 239 | def generate_COVID_aux_input(df_roaming, 240 | df_infection_ratio, 241 | passenger_flights, 242 | df_incoming): 243 | 244 | columns = df_roaming.columns 245 | 246 | start_day_roaming = np.where(df_roaming.columns == df_incoming.loc[0, 'date'])[0][0] +13 247 | start_day_infection = np.where(df_infection_ratio.columns == df_incoming.loc[0, 'date'])[0][0] +13 248 | start_day_passenger = np.where(passenger_flights.columns == df_incoming.loc[0, 'date'])[0][0] +13 249 | 250 | end_day = np.where(columns == '5/5/20')[0][0] 251 | 252 | data = [] 253 | for day in range(end_day - start_day_roaming + 1): 254 | country_dict = {} 255 | for idx, country in enumerate(df_roaming.Country): 256 | _ = np.concatenate(( 257 | np.expand_dims(np.array(df_roaming.loc[idx, df_roaming.columns[start_day_roaming + day]], dtype=np.float), axis=1), 258 | np.expand_dims(np.array(df_infection_ratio.loc[idx, df_infection_ratio.columns[start_day_infection + day]], dtype=np.float), axis=1), 259 | np.expand_dims(np.array(passenger_flights.loc[idx, passenger_flights.columns[start_day_passenger + day]], dtype=np.float), axis=1), 260 | ), 261 | axis=-1) 262 | 263 | country_dict[country] = _ 264 | 265 | data.append(country_dict) 266 | 267 | return data -------------------------------------------------------------------------------- /dataset/trend_mask.csv: -------------------------------------------------------------------------------- 1 | ,AR,AU,AT,BO,BR,CA,CL,CN,CO,HR,CZ,EG,EE,FI,FR,DE,GR,HU,IN,ID,IR,IE,IT,JP,KR,KW,MY,MX,NL,PK,PE,PH,PL,PT,QA,RU,SG,ZA,ES,SE,CH,TH,TR,AE,GB,UY,US,VN,date 2 | 0,35,51,31,0,58,25,46,38,52,16,20,55,17,53,43,28,26,43,14,63,33,35,35,48,62,100,14,52,39,35,86,33,34,45,100,57,12,11,39,66,52,60,41,40,34,45,13,63,20200301 3 | 1,45,57,30,29,41,22,47,30,39,18,19,65,38,47,38,27,23,32,18,96,45,28,31,50,66,86,20,39,39,36,41,31,28,39,93,41,11,9,26,68,35,95,42,44,37,0,13,73,20200302 4 | 2,38,54,24,28,43,20,18,22,25,7,17,45,28,32,35,25,25,22,49,94,34,19,32,45,73,68,25,33,34,29,36,31,33,48,70,55,11,10,34,64,57,82,27,41,32,71,11,59,20200303 5 | 3,37,51,22,27,44,19,55,15,40,25,16,66,22,32,34,20,18,35,100,67,28,29,33,60,71,65,23,43,27,22,18,37,28,43,70,63,12,10,34,61,41,73,34,41,34,70,10,66,20200304 6 | 4,22,52,26,55,38,19,45,15,69,27,14,49,21,24,31,22,32,32,92,66,32,25,34,49,100,51,29,48,36,14,40,26,36,28,47,49,13,28,35,57,31,72,25,46,30,0,10,66,20200305 7 | 5,49,45,23,0,48,18,46,30,57,7,13,63,21,38,28,25,29,30,60,58,40,23,42,47,80,44,33,35,34,16,47,30,30,31,31,59,12,23,31,75,42,80,35,40,26,35,10,61,20200306 8 | 6,68,43,24,0,42,21,36,77,44,35,18,35,31,39,30,25,25,34,46,54,29,21,41,48,61,15,31,54,34,15,51,44,33,27,32,81,12,14,23,55,33,69,32,43,24,85,10,67,20200307 9 | 7,42,47,29,34,41,19,51,86,39,21,13,47,10,36,31,21,31,39,33,56,22,20,41,36,69,50,29,26,29,15,30,40,25,24,32,82,13,13,38,62,47,61,30,41,25,42,9,75,20200308 10 | 8,45,43,17,28,35,17,28,36,36,18,14,58,14,35,28,23,37,29,37,48,35,26,55,33,74,45,32,54,23,20,32,78,29,54,83,78,13,13,35,55,40,67,27,35,22,65,9,72,20200309 11 | 9,57,48,26,40,40,18,32,50,45,26,15,60,36,33,24,45,27,45,34,50,39,28,68,42,53,33,33,42,34,19,28,85,29,47,60,65,11,13,36,68,47,53,51,39,26,0,9,67,20200310 12 | 10,29,49,33,55,37,23,39,28,42,45,18,41,30,45,28,44,18,54,37,51,30,25,64,47,60,32,39,35,42,20,34,89,39,40,67,49,11,15,42,60,33,56,100,31,27,0,10,77,20200311 13 | 11,51,62,33,58,52,32,32,61,59,62,21,45,44,66,28,27,51,67,39,50,38,31,70,42,63,58,59,50,44,30,27,98,35,42,67,62,15,14,54,86,40,62,67,38,34,0,14,74,20200312 14 | 12,39,60,42,34,65,34,45,65,65,53,23,50,25,38,31,31,51,70,51,55,40,30,59,47,57,39,70,51,43,50,47,97,34,69,35,53,13,16,38,63,54,68,46,30,34,34,13,74,20200313 15 | 13,49,64,72,39,76,29,65,36,58,46,29,59,44,66,34,30,67,87,64,68,41,32,73,38,52,38,74,47,42,72,44,95,49,69,69,72,14,16,41,77,75,66,40,39,36,79,13,65,20200314 16 | 14,43,68,34,39,71,30,45,85,58,43,50,82,42,44,39,28,43,78,57,71,20,40,75,37,48,30,74,52,45,50,33,95,32,92,56,87,15,29,39,82,45,70,41,42,43,65,13,100,20200315 17 | 15,30,61,26,46,75,28,49,76,43,41,86,85,51,40,34,23,46,82,60,70,34,26,60,40,71,39,88,70,49,71,57,100,30,77,49,73,14,42,45,65,43,57,43,49,40,60,12,97,20200316 18 | 16,46,68,44,41,63,29,55,49,56,32,100,83,32,58,30,49,57,84,58,63,24,35,54,44,52,52,72,62,44,72,50,80,36,73,40,100,13,36,34,54,37,90,44,45,40,34,13,92,20200317 19 | 17,49,66,44,31,85,30,62,76,55,49,94,100,47,37,32,40,44,86,57,69,32,33,73,39,49,48,77,69,51,83,49,88,32,70,40,84,12,35,43,65,48,100,48,45,36,83,14,78,20200318 20 | 18,40,58,34,45,75,33,41,13,68,36,62,92,28,50,37,30,60,93,62,62,25,34,76,48,49,44,85,55,48,68,38,76,36,58,57,67,12,29,47,62,70,87,45,35,35,66,17,80,20200319 21 | 19,55,62,37,45,68,35,66,58,59,63,54,77,25,24,42,31,51,77,65,75,16,42,70,34,40,21,98,58,46,79,77,65,35,73,36,60,17,28,56,59,49,93,48,45,38,33,20,78,20200320 22 | 20,34,79,41,38,90,44,69,81,51,100,50,82,46,46,47,32,64,100,69,73,100,46,69,35,41,26,100,67,51,91,58,79,48,66,36,74,18,28,55,63,86,81,52,42,43,54,28,73,20200321 23 | 21,55,81,29,36,88,46,64,45,43,63,41,75,62,58,48,30,32,85,36,85,37,39,60,34,37,32,84,61,48,100,57,75,42,93,31,87,18,27,67,72,77,71,49,40,51,0,27,84,20200322 24 | 22,45,86,46,28,76,44,66,65,58,98,32,59,38,45,32,37,42,72,48,76,30,38,51,38,46,25,73,58,42,87,61,77,49,64,42,64,18,37,54,65,53,90,44,78,49,30,25,80,20200323 25 | 23,45,95,53,31,65,40,54,41,44,64,41,69,38,46,30,64,45,82,42,71,58,44,56,47,46,46,67,56,46,80,61,67,49,57,60,67,18,34,52,55,51,82,41,66,44,64,23,69,20200324 26 | 24,49,83,60,64,49,37,55,49,68,65,34,60,50,42,36,48,45,94,33,80,38,34,54,44,38,49,69,53,40,93,40,70,36,49,42,51,16,32,50,62,61,78,40,61,41,32,20,67,20200325 27 | 25,68,92,44,30,60,39,43,54,89,44,31,56,31,45,30,36,48,75,31,73,33,42,56,53,43,33,70,65,36,83,49,67,38,52,40,67,17,27,51,69,52,89,29,39,43,0,21,70,20200326 28 | 26,50,75,27,30,63,37,55,61,62,46,20,53,45,42,38,38,42,100,31,76,48,40,65,47,43,30,51,69,46,68,40,64,38,48,28,65,17,25,40,65,61,79,36,42,43,60,21,82,20200327 29 | 27,44,84,35,68,64,38,63,78,65,67,35,53,44,40,37,36,39,94,29,83,68,44,67,47,38,28,54,78,45,66,57,59,54,59,41,74,19,31,47,58,57,51,41,100,49,0,24,65,20200328 30 | 28,60,73,33,35,56,42,30,98,33,49,24,48,62,55,39,38,40,56,29,76,34,39,56,38,26,42,51,73,44,74,60,53,39,61,50,84,22,30,40,66,50,64,47,95,47,56,25,60,20200329 31 | 29,70,64,89,32,64,44,57,30,66,33,43,56,47,48,30,39,38,59,28,69,21,31,68,44,47,43,50,79,57,75,42,54,44,44,48,64,22,36,42,69,51,79,46,71,44,41,24,73,20200330 32 | 30,43,67,100,31,59,46,39,67,53,47,31,45,15,46,45,90,34,84,28,69,38,44,75,53,46,56,42,63,39,63,35,61,53,64,61,71,20,35,38,73,77,75,33,54,41,30,32,65,20200331 33 | 31,52,67,90,31,59,49,50,55,54,40,24,55,68,46,55,53,23,71,25,69,45,45,65,73,62,42,34,63,37,60,35,54,39,61,46,68,22,33,44,80,100,71,46,51,42,58,36,72,20200401 34 | 32,41,67,72,62,87,58,36,25,45,31,38,64,100,55,55,47,40,56,24,67,50,58,69,84,60,52,35,68,43,55,35,60,44,67,48,73,28,30,49,66,66,76,45,51,72,30,46,73,20200402 35 | 33,54,87,65,67,95,80,51,26,57,37,28,69,52,45,44,56,41,60,25,73,36,67,72,83,61,39,37,84,51,57,84,56,53,68,62,60,47,32,59,79,68,79,69,54,60,66,76,77,20200403 36 | 34,76,100,58,69,76,100,52,61,38,37,34,75,61,69,83,46,37,76,34,79,40,60,93,65,54,50,38,84,40,50,69,63,63,81,59,63,63,36,70,100,78,76,98,78,59,39,100,81,20200404 37 | 35,80,79,49,69,84,82,65,56,76,35,27,80,60,59,69,45,34,64,30,100,55,50,100,58,31,43,39,80,47,55,60,67,58,73,63,65,100,30,75,86,68,80,85,63,47,40,72,79,20200405 38 | 36,45,59,68,31,74,74,51,25,76,21,25,68,69,68,56,42,39,37,30,89,63,44,85,89,41,40,37,72,41,40,53,65,42,95,55,69,51,33,72,73,70,63,70,49,45,67,58,78,20200406 39 | 37,81,56,44,32,69,81,53,17,92,40,25,73,43,56,53,48,31,48,29,82,33,39,81,84,45,49,36,76,38,48,59,62,37,81,45,65,33,33,67,69,61,62,49,48,43,71,52,83,20200407 40 | 38,52,54,62,53,63,60,51,41,67,63,13,71,81,68,100,54,36,34,31,75,31,35,77,71,44,51,33,100,41,52,38,57,52,70,48,52,46,30,60,61,43,56,47,51,43,73,46,72,20200408 41 | 39,56,48,47,100,77,52,85,24,49,26,36,66,70,63,72,35,34,57,33,73,39,37,66,76,36,35,35,85,42,48,46,55,100,67,49,47,37,30,68,58,59,57,42,47,38,75,42,72,20200409 42 | 40,81,41,40,53,77,54,58,44,64,39,18,54,54,59,45,31,37,51,32,83,31,40,69,74,35,40,36,98,41,50,21,48,74,78,31,54,37,37,65,50,68,52,41,41,39,0,42,73,20200410 43 | 41,75,50,52,0,78,49,74,46,65,59,22,61,42,71,47,35,36,55,30,79,46,28,70,71,35,42,36,76,37,53,38,57,60,51,48,65,46,46,61,54,75,50,37,40,35,83,41,83,20200411 44 | 42,72,45,45,54,61,44,75,56,58,50,17,64,32,41,44,32,34,58,27,79,36,34,58,57,37,36,31,77,43,43,100,51,54,66,32,76,45,33,66,57,59,49,41,46,31,42,32,68,20200412 45 | 43,100,41,37,66,55,41,46,31,92,46,14,64,48,57,53,37,35,48,29,74,43,32,72,65,40,49,29,87,35,54,54,52,56,93,41,48,29,48,62,68,49,47,37,35,49,52,29,70,20200413 46 | 44,62,41,58,0,71,38,68,42,57,29,13,57,64,100,43,55,24,69,27,71,25,32,60,63,41,43,30,77,35,45,56,54,61,100,53,50,38,42,62,60,83,43,38,40,48,30,31,78,20200414 47 | 45,79,38,50,81,68,39,55,48,100,21,19,52,44,59,47,52,36,44,26,73,31,29,64,66,33,43,28,86,39,39,53,58,65,72,39,56,42,36,68,49,72,37,39,35,41,49,33,86,20200415 48 | 46,73,36,38,48,60,40,35,35,60,18,19,46,36,50,48,46,31,50,27,72,42,44,66,61,26,36,28,89,43,45,69,63,78,74,46,69,39,44,78,75,67,50,38,38,44,33,40,69,20200416 49 | 47,90,42,47,32,72,43,66,32,61,52,18,64,33,66,45,47,26,39,25,75,52,49,70,61,26,29,30,77,34,41,69,58,74,75,41,52,32,35,87,60,65,49,39,38,64,0,38,59,20200417 50 | 48,59,44,36,70,100,47,77,44,82,33,11,60,31,59,54,49,20,58,27,76,31,39,82,61,30,47,29,56,38,41,52,56,79,90,51,64,31,37,100,53,39,43,41,27,51,40,42,83,20200418 51 | 49,66,38,41,36,73,42,91,47,62,23,12,39,46,44,57,42,38,57,27,75,43,40,68,56,25,70,26,72,42,40,58,51,58,71,47,78,25,35,78,58,59,42,43,34,45,60,36,83,20200419 52 | 50,68,34,34,73,68,38,82,25,83,33,13,61,34,35,44,50,23,51,27,64,29,43,69,71,40,18,29,72,49,42,44,54,54,59,20,47,21,40,66,56,86,41,39,34,44,63,30,68,20200420 53 | 51,70,33,47,95,75,40,61,58,55,21,16,48,29,22,48,80,20,62,27,64,30,42,69,100,34,41,29,59,35,40,65,56,46,66,44,54,17,35,73,45,55,44,36,34,57,31,30,66,20200421 54 | 52,44,34,45,43,79,39,75,23,68,18,25,40,27,38,49,96,38,39,25,65,30,48,78,78,33,31,26,70,44,43,44,53,45,56,41,49,18,40,68,47,72,39,33,33,52,42,30,79,20200422 55 | 53,58,34,45,53,82,40,61,16,44,42,6,45,32,38,57,72,33,37,25,64,23,42,74,75,38,27,20,61,37,48,70,57,47,55,77,49,19,74,61,55,66,46,31,42,59,64,32,64,20200423 56 | 54,64,35,53,65,57,37,93,30,73,42,14,37,51,53,48,72,41,43,25,71,27,38,78,68,27,25,24,62,35,47,71,52,41,79,28,46,18,100,65,49,79,39,37,42,40,48,30,65,20200424 57 | 55,67,35,33,69,70,40,100,28,97,26,29,31,37,36,52,61,50,65,27,72,25,38,77,66,35,29,26,70,38,42,91,56,39,60,22,62,18,83,70,51,81,42,33,33,44,37,32,64,20200425 58 | 56,74,36,41,51,73,37,54,46,79,40,17,49,39,45,59,60,27,43,27,74,25,45,64,56,37,43,24,75,38,40,51,48,38,70,67,48,16,76,59,61,45,37,37,47,44,38,29,71,20200426 59 | 57,31,29,18,32,73,33,67,23,52,32,12,58,40,42,52,62,49,42,28,70,23,43,69,81,37,28,21,71,37,46,65,57,29,57,43,52,16,65,72,52,59,32,32,37,40,61,27,70,20200427 60 | 58,39,27,39,32,63,37,45,34,61,21,14,46,28,39,53,100,48,55,28,65,23,50,70,57,43,58,24,69,39,53,56,56,34,81,53,55,14,59,68,55,86,36,29,38,60,39,29,75,20200428 61 | 59,51,31,66,61,68,40,61,36,43,23,17,31,29,59,57,89,100,48,25,73,16,71,72,52,31,32,20,53,36,32,56,57,35,52,40,55,16,66,69,59,72,33,38,36,55,31,30,70,20200429 62 | 60,49,27,36,69,68,44,33,11,36,20,13,63,31,39,54,49,67,51,26,83,26,51,67,51,28,38,23,57,48,42,89,55,37,71,45,48,15,64,64,46,65,45,32,42,59,50,29,59,20200430 63 | 61,80,26,51,50,72,42,34,100,69,37,15,54,24,56,57,53,57,42,25,73,25,50,88,43,20,32,27,63,49,39,51,62,46,75,50,60,15,71,67,52,61,42,33,47,63,60,29,61,20200501 64 | 62,53,33,47,33,81,42,49,20,46,36,17,53,25,33,63,46,61,36,31,77,25,55,83,45,26,33,31,67,44,39,71,58,41,77,30,65,16,63,60,59,97,39,37,40,58,54,30,60,20200502 65 | 63,56,34,36,46,72,39,89,21,59,20,13,54,20,56,53,39,67,33,28,67,26,50,69,40,18,33,28,63,37,37,33,57,36,85,49,66,18,59,54,52,65,38,34,40,54,0,28,65,20200503 66 | 64,66,28,34,58,65,39,69,27,31,32,13,53,21,38,58,34,43,35,29,69,33,47,75,44,27,28,32,60,39,33,76,61,38,90,33,56,18,58,55,56,45,35,29,42,58,30,25,66,20200504 67 | 65,66,32,39,34,70,40,42,34,55,29,12,60,35,30,63,36,53,47,31,67,21,50,98,43,38,55,30,51,50,43,71,59,40,81,44,66,17,53,59,53,72,33,37,42,51,56,26,79,20200505 68 | 66,50,30,39,43,66,39,46,48,72,38,17,50,22,38,54,33,34,49,31,66,22,44,77,50,35,45,29,52,100,30,48,57,35,85,41,68,17,51,65,53,64,32,44,34,46,63,26,63,20200506 69 | 67,59,33,31,48,78,42,53,18,60,7,13,52,16,47,55,37,36,38,29,70,24,39,79,39,33,13,32,50,87,41,44,59,31,74,34,70,18,46,62,57,59,43,37,47,44,66,25,61,20200507 70 | 68,85,32,36,60,59,40,39,29,55,23,12,60,38,43,57,35,33,53,31,76,16,36,82,43,24,23,29,60,69,27,75,55,34,95,31,62,15,39,65,60,40,41,35,35,39,46,25,66,20200508 71 | 69,76,32,38,65,72,42,44,38,73,37,9,63,25,43,53,35,43,42,32,68,19,34,94,43,15,37,34,55,67,39,73,53,45,79,34,74,18,38,87,55,61,39,34,43,38,42,28,86,20200509 72 | 70,66,33,27,76,75,39,66,48,48,17,9,78,29,50,53,31,35,35,30,79,16,39,90,40,20,16,24,63,51,34,41,45,30,54,38,60,16,30,78,55,46,35,41,33,47,100,24,64,20200510 73 | 71,57,28,31,48,57,37,50,46,40,10,18,80,17,32,61,25,34,28,33,66,27,51,68,44,39,63,34,52,52,36,66,54,29,66,42,51,15,35,68,45,39,32,38,44,100,64,23,62,20200511 74 | 72,46,30,26,42,74,39,81,33,57,20,19,60,12,43,56,31,32,34,45,64,25,76,75,47,30,64,30,64,47,39,59,53,27,57,31,65,14,44,70,52,62,35,40,36,95,66,24,63,20200512 75 | 73,62,29,38,43,64,42,62,23,69,22,19,94,18,62,47,31,40,34,41,77,38,79,70,44,33,20,28,57,49,39,64,65,31,48,56,63,15,37,64,49,44,31,36,36,78,99,25,62,20200513 76 | 74,47,27,32,58,60,41,43,23,71,21,13,76,20,49,44,31,34,37,40,74,18,63,68,45,29,53,28,61,46,36,69,73,30,62,72,67,13,33,76,54,57,39,36,40,65,50,26,48,20200514 77 | 75,45,29,43,45,54,40,25,24,55,29,12,93,17,43,51,33,25,55,40,72,10,76,66,39,30,26,29,56,48,32,52,63,28,66,36,51,15,37,74,50,61,35,27,40,57,34,26,61,20200515 78 | 76,80,32,48,98,58,40,26,58,64,13,15,84,27,39,45,41,35,40,42,73,32,100,80,41,28,49,28,58,53,38,69,78,38,62,53,56,17,30,59,53,38,32,34,54,52,86,26,52,20200516 79 | 77,92,33,39,33,61,38,37,29,83,29,16,100,13,24,39,31,30,21,40,82,15,73,69,40,22,31,30,66,49,35,51,76,29,69,44,60,17,29,80,57,39,39,37,45,47,43,24,53,20200517 80 | 78,77,29,23,57,72,37,51,30,39,21,16,90,16,46,39,26,23,34,39,75,28,74,70,42,37,49,27,55,40,36,59,82,26,60,55,75,15,30,66,46,58,31,34,47,47,54,22,59,20200518 81 | 79,37,29,40,38,55,35,60,41,65,20,14,75,8,40,35,27,23,41,39,80,29,58,67,43,29,59,27,58,43,39,57,70,30,44,47,60,18,31,72,43,48,30,33,48,42,32,22,48,20200519 82 | -------------------------------------------------------------------------------- /data_loader.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | from sklearn.preprocessing import StandardScaler 5 | from utils import sum_country_regions, get_change_rates, generate_df_change_rate, sliding_window, generate_COVID_input, generate_COVID_aux_input 6 | 7 | import pickle 8 | import copy 9 | import os 10 | import argparse 11 | 12 | 13 | parser = argparse.ArgumentParser(description='Hi-covidnet DATALOADER') 14 | 15 | # basic settings 16 | parser.add_argument('--output_size', type=int, default=14, metavar='O', help='How many days you are predicting(default: 14)') 17 | parser.add_argument('--save', action='store_true', default=False, help='Saving pre-processed data') 18 | 19 | def normalize(df, axis=1): 20 | """ 21 | @df : shape(N,D) 22 | """ 23 | mean = df.iloc[:,4:].mean(axis=axis) # (D) 24 | std = df.iloc[:,4:].std(axis=axis) # (D) 25 | df.iloc[:,4:] = (df.iloc[:,4:].subtract(mean, axis='index')).divide(std, axis='index') 26 | return df, mean, std 27 | 28 | def scaling(df_confirm,df_death, df_confirm_change_1st_order, 29 | df_confirm_change_2nd_order,df_death_change_1st_order, 30 | df_death_change_2nd_order, fname="x_mean_std_list_5_27.pkl"): 31 | ##scaling 32 | mean_std_list = [] 33 | 34 | df_confirm, mean, std = normalize(df_confirm, axis=1) 35 | mean_std_list.append((mean,std)) 36 | 37 | df_death, mean, std = normalize(df_death, axis=1) 38 | mean_std_list.append((mean,std)) 39 | 40 | df_confirm_change_1st_order, mean, std = normalize(df_confirm_change_1st_order, axis=1) 41 | mean_std_list.append((mean,std)) 42 | 43 | df_confirm_change_2nd_order, mean, std = normalize(df_confirm_change_2nd_order, axis=1) 44 | mean_std_list.append((mean,std)) 45 | 46 | df_death_change_1st_order, mean, std = normalize(df_death_change_1st_order, axis=1) 47 | mean_std_list.append((mean,std)) 48 | 49 | df_death_change_2nd_order, mean, std = normalize(df_death_change_2nd_order, axis=1) 50 | mean_std_list.append((mean,std)) 51 | 52 | pickle.dump(mean_std_list, open("pickled_ds/"+fname, "wb")) 53 | 54 | def google_trenddata_loader(fname, countries_Korea_inbound): 55 | google_trend = pd.read_csv('./dataset/{fname}.csv'.format(fname=fname), index_col=0) 56 | 57 | iso_to_country = countries_Korea_inbound.set_index('iso').to_dict()['Country'] 58 | google_trend.rename(columns = iso_to_country, inplace = True) 59 | google_trend = google_trend.set_index('date').T.reset_index() 60 | google_trend = google_trend.rename(columns = {'index': 'Country'}) 61 | google_trend.columns = google_trend.columns.astype(str) 62 | google_trend = google_trend.rename(columns = {col: str(int(col[4:6]))+'/'+str(int(col[-2:]))+'/' + col[2:4] for col in google_trend.columns[1:].astype(str)}) 63 | google_trend.loc[:, google_trend.columns[1:]] /= 100 64 | 65 | google_trend.drop(np.argwhere(google_trend.Country == 'Korea, South')[0], inplace=True) 66 | 67 | mean, std = google_trend.iloc[:,1:].mean(axis=1), google_trend.iloc[:,1:].std(axis=1) 68 | google_trend.iloc[:,1:] = google_trend.iloc[:,1:].subtract(mean, axis='index').divide(std, axis='index') 69 | return google_trend 70 | 71 | def dataloader(output_size, save=False): 72 | url_confirm = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv' 73 | df_confirm = pd.read_csv(url_confirm, error_bad_lines=False) 74 | 75 | url_death = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv' 76 | df_death = pd.read_csv(url_death, error_bad_lines=False) 77 | 78 | countries_with_regions = df_confirm['Country/Region'].value_counts()[df_confirm['Country/Region'].value_counts()>1].index 79 | for country in countries_with_regions: 80 | df_confirm = sum_country_regions(df_confirm, country) 81 | df_death = sum_country_regions(df_death, country) 82 | 83 | df_confirm.reset_index(inplace=True, drop=True) 84 | df_death.reset_index(inplace=True, drop=True) 85 | 86 | # Get the index of the 'last zero patients' from the countries 87 | selected_index = {} 88 | for country in range(len(df_confirm)): 89 | try: df_confirm.loc[country] # No country due to merged 90 | except Exception as e: continue 91 | try: 92 | selected_index[country] = list(filter(lambda i: df_confirm.loc[country].eq(0)[i], range(len(df_confirm.columns))))[-1] 93 | except Exception as e: 94 | selected_index[country] = 4 95 | 96 | 97 | countries_Korea_inbound = pd.read_csv("./dataset/country_info.csv") 98 | 99 | countries_Korea_inbound.loc[countries_Korea_inbound['Country'] == 'China', 'continent'] = 'China' 100 | selected_country = countries_Korea_inbound.loc[countries_Korea_inbound.visit.eq(1), 'Country'].values 101 | 102 | df_confirm_change_1st_order = generate_df_change_rate(df_confirm, days=1) 103 | df_confirm_change_2nd_order = generate_df_change_rate(df_confirm_change_1st_order, days=1) 104 | df_death_change_1st_order = generate_df_change_rate(df_death, days=1) 105 | df_death_change_2nd_order = generate_df_change_rate(df_death_change_1st_order, days=1) 106 | 107 | scaling(df_confirm,df_death, df_confirm_change_1st_order, 108 | df_confirm_change_2nd_order,df_death_change_1st_order, 109 | df_death_change_2nd_order) 110 | 111 | fnames = ["trend_covid-19", "trend_covid_test", "trend_flu", "trend_mask"] 112 | google_data = [google_trenddata_loader(fname, countries_Korea_inbound) for fname in fnames] 113 | 114 | df_incoming = pd.read_csv('./dataset/confirmed_by_continent.csv') 115 | scaler_list = pickle.load(open("pickled_ds/x_mean_std_list_5_27.pkl", "rb")) 116 | 117 | data_model2, target_continent, target_total = generate_COVID_input(df_death, 118 | df_death_change_1st_order, 119 | df_death_change_2nd_order, 120 | df_death_change_1st_order, 121 | df_confirm_change_1st_order, 122 | df_confirm_change_2nd_order, 123 | df_incoming, 124 | *google_data, 125 | countries_Korea_inbound, 126 | seq_length=14, 127 | end_day='5/6/20', # '5/5/20' 128 | is_7days= True if output_size==7 else False, 129 | scaler_list=scaler_list) 130 | 131 | print("data shape is ",len(data_model2), data_model2[30]['Argentina'].shape) 132 | print("target_continent shape is ",target_continent.shape, "target_total shape is ",target_total.shape,) 133 | 134 | print("Loading KT roaming data") 135 | roaming = pd.read_csv('./dataset/roaming_preprocess.csv') 136 | df_roaming = pd.DataFrame(selected_country, columns=['Country']) 137 | columns = roaming['date'].unique() 138 | df_columns = pd.DataFrame(columns=columns) 139 | df_roaming = pd.concat((df_roaming, df_columns)) 140 | iso_to_country = countries_Korea_inbound.set_index('iso').to_dict()['Country'] 141 | country_to_iso = {v:k for k,v in iso_to_country.items()} 142 | for country in selected_country: 143 | df_roaming.loc[df_roaming.Country == country, df_roaming.columns[1:]] = roaming.loc[roaming.iso == country_to_iso[country], ['counts']].T.values 144 | df_roaming.columns = df_roaming.columns.astype(str) 145 | df_roaming = df_roaming.rename(columns = {col: str(int(col[4:6]))+'/'+str(int(col[-2:]))+'/' + col[2:4] for col in df_roaming.columns[1:].astype(str)}) 146 | df_roaming.loc[:, df_roaming.columns[1:]] = df_roaming.loc[:, df_roaming.columns[1:]]/df_roaming.loc[:, df_roaming.columns[1:]].sum(axis=0) 147 | 148 | mean, std = df_roaming.iloc[:,1:].mean(axis=1), df_roaming.iloc[:,1:].std(axis=1) 149 | std[24] += 1 150 | df_roaming.iloc[:,1:] = df_roaming.iloc[:,1:].subtract(mean, axis='index').divide(std, axis='index') 151 | 152 | print("Loading infection ratio data") 153 | df_infection_ratio = df_roaming.copy() 154 | df_infection_ratio.loc[:, df_infection_ratio.columns[1:]] = 0 155 | for idx, country in enumerate(df_infection_ratio.Country): 156 | df_infection_ratio.loc[df_infection_ratio.Country == country, df_infection_ratio.columns[1:]] = df_confirm.loc[df_confirm['Country/Region'] == country, df_infection_ratio.columns[1:]].values/countries_Korea_inbound.loc[countries_Korea_inbound.Country == country, 'population'].values 157 | 158 | mean, std = df_infection_ratio.iloc[:,1:].mean(axis=1), df_infection_ratio.iloc[:,1:].std(axis=1) 159 | df_infection_ratio.iloc[:,1:] = df_infection_ratio.iloc[:,1:].subtract(mean, axis='index').divide(std, axis='index') 160 | 161 | print("Loading passenger flights data") 162 | passenger_flights = pd.read_csv('./dataset/ICN_arrive_preprocess.csv') 163 | passenger_flights.rename(columns={passenger_flights.columns[0]:'Country'}, inplace=True) 164 | passenger_flights.loc[:, passenger_flights.columns[1:]] = passenger_flights.loc[:, passenger_flights.columns[1:]]/passenger_flights.loc[:, passenger_flights.columns[1:]].sum(axis=0) 165 | 166 | mean, std = passenger_flights.iloc[:,1:].mean(axis=1), passenger_flights.iloc[:,1:].std(axis=1) 167 | passenger_flights.iloc[:,1:] = passenger_flights.iloc[:,1:].subtract(mean, axis='index').divide(std+1e-5, axis='index') 168 | 169 | data_AUX = generate_COVID_aux_input(df_roaming, 170 | df_infection_ratio, 171 | passenger_flights, 172 | df_incoming) 173 | 174 | print("Normalizing continent target") 175 | cat_target_continent = None 176 | for i in range(len(target_continent)): 177 | if i==0: 178 | cat_target_continent = target_continent[i] 179 | else : 180 | cat_target_continent = np.concatenate([cat_target_continent, target_continent[i][-1:,:]],axis=0) 181 | mean, std = cat_target_continent.mean(axis=0),cat_target_continent.std(axis=0) 182 | if output_size==7: 183 | pickle.dump((mean, std), open("pickled_ds/target_continent_mean_std_window7.pkl", "wb")) 184 | else : 185 | pickle.dump((mean, std), open("pickled_ds/target_continent_mean_std_window14.pkl", "wb")) 186 | target_continent = target_continent.astype(np.float) 187 | for i in range(len(target_continent)): 188 | target_continent[i] = (target_continent[i]-mean)/std 189 | 190 | 191 | print("Normalizing total target") 192 | cat_target_total = np.concatenate([target_total[:,0],target_total[-1,1:]], axis=0) 193 | mean, std = cat_target_total.mean(),cat_target_total.std() 194 | if output_size==7: 195 | pickle.dump((mean, std), open("pickled_ds/target_total_mean_std_window7.pkl", "wb")) #target_total_mean_std_window14 196 | else: 197 | pickle.dump((mean, std), open("pickled_ds/target_total_mean_std_window14.pkl", "wb")) 198 | target_total = (target_total-mean)/std 199 | 200 | if save : 201 | if output_size==7: 202 | # train_data 203 | pickle.dump(countries_Korea_inbound, open("pickled_ds/countries_Korea_inbound_window7_google.pkl", "wb")) 204 | pickle.dump(data_model2[:-1], open("pickled_ds/data_model2_normal_window7_google.pkl", "wb")) 205 | pickle.dump(data_AUX[:-1], open("pickled_ds/data_AUX_normal_window7_google.pkl", "wb")) 206 | pickle.dump(target_continent[:-1], open("pickled_ds/target_continent_normal_window7_google.pkl", "wb")) 207 | pickle.dump(target_total[:-1], open("pickled_ds/target_total_normal_window7_google.pkl", "wb")) 208 | # test_data 209 | pickle.dump(countries_Korea_inbound, open("pickled_ds/countries_Korea_inbound_window7_google_test.pkl", "wb")) 210 | pickle.dump(data_model2[-1], open("pickled_ds/data_model2_normal_window7_google_test.pkl", "wb")) 211 | pickle.dump(data_AUX[-1], open("pickled_ds/data_AUX_normal_window7_google_test.pkl", "wb")) 212 | pickle.dump(target_continent[-1], open("pickled_ds/target_continent_normal_window7_google_test.pkl", "wb")) 213 | pickle.dump(target_total[-1], open("pickled_ds/target_total_normal_window7_google_test.pkl", "wb")) 214 | else : #output_size==14 215 | # train_data 216 | pickle.dump(countries_Korea_inbound, open("pickled_ds/countries_Korea_inbound_window14_google.pkl", "wb")) 217 | pickle.dump(data_model2[:-1], open("pickled_ds/data_model2_normal_window14_google.pkl", "wb")) 218 | pickle.dump(data_AUX[:-1], open("pickled_ds/data_AUX_normal_window14_google.pkl", "wb")) 219 | pickle.dump(target_continent[:-1], open("pickled_ds/target_continent_normal_window14_google.pkl", "wb")) 220 | pickle.dump(target_total[:-1], open("pickled_ds/target_total_normal_window14_google.pkl", "wb")) 221 | # test_data 222 | pickle.dump(countries_Korea_inbound, open("pickled_ds/countries_Korea_inbound_window14_google_test.pkl", "wb")) 223 | pickle.dump(data_model2[-1], open("pickled_ds/data_model2_normal_window14_google_test.pkl", "wb")) 224 | pickle.dump(data_AUX[-1], open("pickled_ds/data_AUX_normal_window14_google_test.pkl", "wb")) 225 | pickle.dump(target_continent[-1], open("pickled_ds/target_continent_normal_window14_google_test.pkl", "wb")) 226 | pickle.dump(target_total[-1], open("pickled_ds/target_total_normal_window14_google_test.pkl", "wb")) 227 | 228 | return data_model2, data_AUX, target_continent, target_total 229 | 230 | def main(): 231 | global opts 232 | opts = parser.parse_args() 233 | data_model2, data_AUX, target_continent, target_total = dataloader(opts.output_size, save=opts.save) 234 | 235 | return data_model2, data_AUX, target_continent, target_total 236 | 237 | if __name__ == '__main__': 238 | main() -------------------------------------------------------------------------------- /covid_aux.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | import torch 5 | import torch.nn as nn 6 | import torch.nn.functional as F 7 | import torch.optim as optim 8 | import torch.nn.utils as torch_utils 9 | 10 | import math 11 | import copy 12 | from tqdm.notebook import tqdm 13 | 14 | import os 15 | 16 | class COVID_AUX_Net(nn.Module): 17 | def __init__(self, df_countries, aux_len=4, feature_len=6, hidden_size=16, num_layers=1, is_aux = True, is_tm = False, output_size = 1): 18 | """ 19 | Parameters 20 | ---------- 21 | df_countries : dataframe of countries which includes 22 | ['Country', 'continent', 'n_confirmed', 'visit', 'iso'] 23 | aux_len : length of auxiliary information that will be concatenated to the hidden dimension 24 | feature_len : dimension of the features 25 | hidden_size : hidden dimension size of LSTM 26 | num_layers : number of LSTM layers 27 | """ 28 | super(COVID_AUX_Net, self).__init__() 29 | self.is_aux = is_aux 30 | self.output_size = output_size 31 | self.hidden_size = hidden_size 32 | 33 | self.continents = df_countries['continent'].unique() 34 | self.countries = np.array(df_countries.loc[df_countries.visit.eq(1), 'Country'].values) 35 | self.countries = np.delete(self.countries, np.argwhere(self.countries == 'Korea, South')) 36 | 37 | 38 | self.country_continent = df_countries.set_index('Country').to_dict()['continent'] 39 | self.continent_country_cnt = {c: len(df_countries.loc[(df_countries.visit.eq(1)) & (df_countries.continent.eq(c))]) for c in self.continents} 40 | self.continent_country_cnt['Asia'] -= 1 41 | # LSTM for each country's trend of patients within the last 14 days 42 | 43 | if is_tm : 44 | self.LSTM_countries = nn.ModuleDict({ 45 | c: nn.Sequential( 46 | TransformerModel(ninp=feature_len, nhead=5, nhid=hidden_size, nlayers=num_layers,), 47 | nn.LSTM(feature_len, hidden_size, num_layers, batch_first=True)) for c in self.countries 48 | }) 49 | else : 50 | self.LSTM_countries = nn.ModuleDict({ 51 | c: nn.Sequential( 52 | nn.LSTM(feature_len, hidden_size, num_layers, batch_first=True)) for c in self.countries 53 | }) 54 | 55 | if self.is_aux : 56 | self.FCN_continent_patients = nn.ModuleDict({ 57 | c: nn.Sequential(nn.Linear((hidden_size + aux_len)*self.continent_country_cnt[c], 8), 58 | nn.ReLU(), 59 | nn.Linear(8, self.output_size)) for c in self.continent_country_cnt 60 | }) 61 | else : # no auxilary data 62 | self.FCN_continent_patients = nn.ModuleDict({ 63 | c: nn.Sequential(nn.Linear(hidden_size*self.continent_country_cnt[c], 8), 64 | nn.ReLU(), 65 | nn.Linear(8, self.output_size)) for c in self.continent_country_cnt 66 | }) 67 | if self.output_size > 1 : 68 | self.FCN_total_patients = nn.ModuleDict({ 69 | day: nn.Linear(len(self.continents), 1) for day in np.array(list(range(self.output_size))).astype(str) 70 | }) 71 | else: 72 | self.FCN_total_patients = nn.Linear(len(self.continents)*self.output_size, self.output_size) 73 | 74 | def forward(self, x, aux): 75 | """ 76 | x: one day with countries {country_name: data of shape (14, feature_len)} 77 | """ 78 | countries_hidden = {} 79 | for c in self.countries: 80 | x_c = torch.as_tensor(x[c], dtype=torch.float).cuda() 81 | x_c[torch.isnan(x_c)] = 0 82 | x_c[torch.isinf(x_c)] = 0 83 | 84 | out, (h_0, c_0) = self.LSTM_countries[c](x_c.unsqueeze(0)) # LSTM prediction of the country 85 | c_ = self.country_continent[c] # Get the continent of the country 86 | if self.is_aux: 87 | h = F.relu(out[:, -1, :].squeeze(0)) 88 | h_ = torch.cat((h, torch.as_tensor(aux[c], dtype=torch.float).cuda()),0) # Concatenate auxiliary information 89 | else : 90 | h_ = F.relu(out[:, -1, :].squeeze(0)) # no auxiliary information 91 | 92 | countries_hidden[c_] = torch.cat((countries_hidden[c_], h_), 0) if c_ in countries_hidden else h_ # Concat hidden vectors 93 | 94 | if self.output_size > 1: 95 | continent_patients_pred = torch.zeros(len(self.continents), self.output_size).cuda() # (#continents:6, output_size:14) 96 | else : # self.output_size = 1 97 | continent_patients_pred = torch.zeros(len(self.continents)).cuda() # (#continents,) 98 | 99 | for idx, c in enumerate(self.continents): 100 | continent_patients_pred[idx] = F.relu(self.FCN_continent_patients[c](countries_hidden[c])) 101 | 102 | if self.output_size > 1: 103 | total_patients_pred = [] 104 | # output, _ = self.lstm_total_patients(continent_patients_pred.transpose(1,0).contiguous().unsqueeze(0)) #(1, T, D) 105 | # output = output.squeeze() #(T:14,D:6) 106 | # print("output.size()", output.size()) 107 | output = continent_patients_pred.transpose(1,0).contiguous() # (T,D) 108 | for idx,day in enumerate(range(output.size(0))): 109 | total_patients_pred.append(self.FCN_total_patients[str(day)](output[idx])) 110 | total_patients_pred = torch.cat(total_patients_pred, axis=0) 111 | else : 112 | total_patients_pred = self.FCN_total_patients(continent_patients_pred) 113 | 114 | return continent_patients_pred, total_patients_pred 115 | 116 | def train_COVID_AUX_Net(model, train_data_model2, train_data_AUX, train_target_continent, 117 | train_target_total,test_data_model2,test_data_AUX, test_target_continent, 118 | test_target_total, num_epoch, model_name="AUX_Net", beta=0.4, lr=None): 119 | """ 120 | @param target_total : (n, output_size : 14 or 7) 121 | @param target_continet : (n, output_size : 14 or 7, #continent : 6) 122 | """ 123 | 124 | criterion = torch.nn.MSELoss() 125 | optimizer = torch.optim.Adam(model.parameters(), lr=lr) 126 | scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones = [20,50,80]) 127 | 128 | Loss_total = [] 129 | Valid_Loss = [] 130 | RMSE_Loss = [] 131 | 132 | model.cuda() 133 | best_valid_loss = np.inf 134 | 135 | for e in tqdm(range(num_epoch)): 136 | ## train 137 | model.train() 138 | for i in range(len(train_data_model2)): 139 | continent_patients_pred, total_patients_pred = model(train_data_model2[i], train_data_AUX[i]) 140 | target_continent_i = torch.as_tensor(train_target_continent[i], dtype=torch.float) 141 | target_total_i = torch.as_tensor(train_target_total[i], dtype=torch.float).unsqueeze(0) 142 | target_continent_i[torch.isnan(target_continent_i)] = 0 143 | target_continent_i[torch.isinf(target_continent_i)] = 0 144 | target_total_i[torch.isnan(target_total_i)] = 0 145 | target_total_i[torch.isinf(target_total_i)] = 0 146 | 147 | optimizer.zero_grad() 148 | loss1 = criterion(continent_patients_pred, target_continent_i.cuda().transpose(1,0)) 149 | loss2 = criterion(total_patients_pred, target_total_i.cuda().squeeze()) 150 | 151 | loss = loss1*beta + loss2*(1-beta) 152 | loss.backward() 153 | optimizer.step() 154 | Loss_total.append(loss.item()) 155 | 156 | if i % 5 == 4 : 157 | print("{e}th epoch train loss : {l}".format(e = e, l = loss)) 158 | 159 | scheduler.step() 160 | if e % 20 == 19 : 161 | torch.save(model.state_dict(), "{model_name}_{e}.pt".format(model_name = model_name, 162 | e=i)) 163 | print(e,"th epoch: model saved!") 164 | 165 | ## validation 166 | model.eval() 167 | with torch.no_grad(): 168 | for i in range(len(test_data_model2)): 169 | continent_patients_pred, total_patients_pred = model(test_data_model2[i], test_data_AUX[i]) 170 | target_continent_i = torch.as_tensor(test_target_continent[i], dtype=torch.float) 171 | target_total_i = torch.as_tensor(test_target_total[i], dtype=torch.float).unsqueeze(0) 172 | target_continent_i[torch.isnan(target_continent_i)] = 0 173 | target_continent_i[torch.isinf(target_continent_i)] = 0 174 | target_total_i[torch.isnan(target_total_i)] = 0 175 | target_total_i[torch.isinf(target_total_i)] = 0 176 | 177 | loss1 = criterion(continent_patients_pred, target_continent_i.cuda().transpose(1,0)) 178 | loss2 = criterion(total_patients_pred, target_total_i.cuda().squeeze()) 179 | 180 | 181 | valid_loss = loss1*beta + loss2*(1-beta) 182 | Valid_Loss.append(valid_loss.item()) 183 | RMSE_Loss.append(torch.sqrt(loss2)) 184 | 185 | avg_val_loss = sum(Valid_Loss[-len(test_data_model2):])/len(test_data_model2) 186 | avg_rmse_loss = sum(RMSE_Loss[-len(test_data_model2):])/len(test_data_model2) 187 | 188 | print("{e}th epoch avg_valid_modelloss : {l} avg_rmse_loss : {rmse}".format(e = e, l = avg_val_loss, 189 | rmse = avg_rmse_loss)) 190 | 191 | 192 | if avg_val_loss < best_valid_loss : 193 | best_valid_loss = avg_val_loss 194 | torch.save(model.state_dict(), "{model_name}_best.pt".format(model_name = model_name,)) 195 | print("best model saved!") 196 | 197 | print("############ epoch finished ############\n") 198 | 199 | return Loss_total, Valid_Loss, RMSE_Loss 200 | 201 | class GlobalRNN(nn.Module): 202 | def __init__(self, input_dim=6, hidden_size=None,is_tm=False): 203 | super(GlobalRNN, self).__init__() 204 | if is_tm: 205 | self.rnn = nn.Sequential( 206 | TransformerModel(ninp=input_dim, nhead=3, nhid=hidden_size, nlayers=1,), 207 | nn.LSTM(input_dim, hidden_size, batch_first=True)) 208 | else : 209 | self.rnn = nn.LSTM(input_dim, hidden_size, batch_first=True) 210 | 211 | self.linear = nn.Linear(hidden_size, input_dim) 212 | 213 | def forward(self, x): 214 | out, hidden = self.rnn(x) 215 | #print(out.shape) 216 | #print(hidden.shape) 217 | # output of shape (seq_len, batch, num_directions * hidden_size) 218 | # h_n of shape (num_layers * num_directions, batch, hidden_size) 219 | result = self.linear(F.relu(out[:, -1, :])) 220 | return result 221 | 222 | 223 | def train_globalrnn(model, data, target, valid_data, valid_target, num_epoch, batch_size, fname, lr =.03,): 224 | data_length = len(data) 225 | data_indices = list(range(data_length)) 226 | criterion = torch.nn.MSELoss() 227 | optimizer = torch.optim.Adam(model.parameters(), lr=lr) 228 | scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones = [20,50,80]) 229 | Loss = [] 230 | Valid_Loss = [] 231 | best_val_loss = np.inf 232 | 233 | for i in tqdm(range(num_epoch)): 234 | 235 | np.random.shuffle(data_indices) 236 | model.train() 237 | 238 | for iteration in range(int(data_length/batch_size)): 239 | data_mini_batch = data[data_indices[iteration*batch_size:(iteration+1)*batch_size]] 240 | target_mini_batch = target[data_indices[iteration*batch_size:(iteration+1)*batch_size]] 241 | data_mini_batch = torch.as_tensor(data_mini_batch) 242 | target_mini_batch = torch.as_tensor(target_mini_batch) 243 | 244 | prediction = model(data_mini_batch) 245 | 246 | optimizer.zero_grad() 247 | loss = criterion(prediction, target_mini_batch) 248 | loss.backward() 249 | 250 | optimizer.step() 251 | Loss.append(loss.item()) 252 | 253 | if iteration % 2 == 1 : 254 | print("{e}th epoch train loss : {l}".format(e = i, l = loss)) 255 | 256 | scheduler.step() 257 | if i % 20 == 19 : 258 | torch.save(model.state_dict(), "{fname}_{e}.pt".format(fname=fname,e=i)) 259 | 260 | ## validation 261 | model.eval() 262 | with torch.no_grad(): 263 | valid_data = torch.as_tensor(valid_data) 264 | valid_target = torch.as_tensor(valid_target) 265 | 266 | valid_prediction = model(valid_data) 267 | valid_loss = criterion(valid_prediction, valid_target) 268 | Valid_Loss.append(valid_loss) 269 | print("{e}th epoch valid loss : {l}".format(e = i, l = valid_loss)) 270 | 271 | 272 | if valid_loss.item() < best_val_loss : 273 | best_val_loss = valid_loss.item() 274 | torch.save(model.state_dict(), "{fname}_best.pt".format(fname=fname)) 275 | print("best model saved!") 276 | 277 | print("############ epoch finished ############\n") 278 | 279 | return Loss, Valid_Loss 280 | 281 | class PositionalEncoding(nn.Module): 282 | 283 | def __init__(self, d_model=6, dropout=0.1, max_len=15): 284 | super(PositionalEncoding, self).__init__() 285 | self.dropout = nn.Dropout(p=dropout) 286 | 287 | pe = torch.zeros(max_len, d_model) 288 | position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1) 289 | div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model)) 290 | pe[:, 0::2] = torch.sin(position * div_term) 291 | pe[:, 1::2] = torch.cos(position * div_term) 292 | pe = pe.unsqueeze(0).transpose(0, 1)# (1,15,6) batch_first : 293 | pe = pe.to(torch.float32) 294 | self.register_buffer('pe', pe) 295 | 296 | def forward(self, x): 297 | x = x.to(torch.float32) 298 | x = x + self.pe[:x.size(0), :] 299 | return self.dropout(x) 300 | 301 | class TransformerModel(nn.Module): 302 | 303 | def __init__(self, ninp, nhead, nhid, nlayers, dropout=0.5): 304 | super(TransformerModel, self).__init__() 305 | from torch.nn import TransformerEncoder, TransformerEncoderLayer 306 | self.model_type = 'Transformer' 307 | self.src_mask = None 308 | self.pos_encoder = PositionalEncoding(ninp, dropout).to(torch.float32) 309 | encoder_layers = TransformerEncoderLayer(ninp, nhead, nhid, dropout,).to(torch.float32) 310 | self.transformer_encoder = TransformerEncoder(encoder_layers, nlayers,).to(torch.float32) 311 | self.ninp = ninp 312 | 313 | def forward(self, src): 314 | """ 315 | src : (N, T, D) = (1,14,6) 316 | """ 317 | src = src.transpose(0,1).contiguous() # (T, N, D) : (14,1,6) 318 | src = src * math.sqrt(self.ninp) 319 | src = self.pos_encoder(src) 320 | src = src.to(torch.float32) 321 | output = self.transformer_encoder(src,) #self.src_mask : we dont need attn mask! bc of the same length data 322 | output = output.transpose(0,1).contiguous() # (N, T, D) = (1,14,6) 323 | return output.to(torch.float32) 324 | --------------------------------------------------------------------------------