From 2df663db768955c9c7b4ecfaca745ab9fde10c2f Mon Sep 17 00:00:00 2001 From: Alagris Date: Mon, 16 May 2022 13:17:12 +0200 Subject: [PATCH] s434749 --- run.py | 22 +- test-A/out.tsv | 1412 ++++++++++++++++++++++++------------------------ 2 files changed, 721 insertions(+), 713 deletions(-) diff --git a/run.py b/run.py index c315e1b..a922d7e 100644 --- a/run.py +++ b/run.py @@ -104,13 +104,21 @@ for month in range(12): z_prev = z.copy() -for month in range(12): - model = model_per_month[month] - u = entries_of_fully_known_stations[:, known_years:, month].T - p = model.predict(u) - p[p<0] = 0 - assert np.all(z[missing_stations, known_years:, month] == -1) - z[missing_stations, known_years:, month] = p.T +METHOD = "mean" +if METHOD == "linear_regression": + for month in range(12): + model = model_per_month[month] + u = entries_of_fully_known_stations[:, known_years:, month].T + p = model.predict(u) + p[p < 0] = 0 + assert np.all(z[missing_stations, known_years:, month] == -1) + z[missing_stations, known_years:, month] = p.T +elif METHOD == "mean": + for year in range(known_years, total_years): + for month in range(12): + assert np.all(z[known_stations, year, month] != -1) + assert np.all(z[missing_stations, year, month] == -1) + z[missing_stations, year, month] = np.mean(z[known_stations, year, month]) assert np.all(z != -1) df = pd.read_csv('test-A/in.tsv', header=None, sep='\t') df.columns = in_columns diff --git a/test-A/out.tsv b/test-A/out.tsv index 7cb404a..4bc3a0b 100644 --- a/test-A/out.tsv +++ b/test-A/out.tsv @@ -1,720 +1,720 @@ -23 -13 -8 -54 -82 -168 -259 -81 +31 +26 18 -50 -3 -28 -24 -9 -22 -29 -79 -82 -291 -91 -6 -39 -0 -39 -34 -28 -49 -10 -55 -59 -139 -52 -35 -15 -9 -36 -40 -14 -36 -0 -57 -38 -145 -41 -22 -8 -8 -41 -48 -25 -32 -12 -38 -28 -159 -2 -15 -14 -7 -35 -42 -38 -3 -41 +37 64 -58 -218 -97 -25 -24 -11 -45 -107 -43 -49 -11 -83 -128 -81 -14 -35 -61 -40 -24 -81 -35 -17 -28 -51 -90 -137 -40 -34 -122 -36 -27 -43 -29 -9 -32 -48 -119 -92 -16 -32 -94 -25 -14 -60 -32 -15 -57 -28 -99 -97 -42 -39 -110 -55 -18 -56 -30 -17 -37 -43 -117 -145 -48 -22 75 -38 -19 -45 -32 -39 -44 -97 -45 -109 -65 -41 -28 -34 -53 -41 -45 -57 -27 -139 -212 -13 -60 -137 -20 -127 -30 -61 -24 -51 -10 -138 -183 -3 -52 -35 -10 -61 -14 -50 -29 -15 -8 -127 -86 -102 -77 -157 -15 -53 -26 -61 -43 -27 -6 -95 -82 -80 -37 -58 -19 -22 -23 -84 -36 -19 -11 -86 -80 -89 -11 -67 -16 -37 -25 -77 -45 -50 -68 -91 -63 -26 -60 -204 -31 -44 -25 -21 -25 -73 -111 -260 -93 -280 -121 -86 -57 -23 -25 -31 -20 -25 -44 -146 -84 -75 -62 -76 -58 -20 -30 -36 -16 -38 -36 -81 -42 -146 -129 -31 -5 -23 -62 -40 -23 -50 -35 -5 -45 -92 -109 -35 -0 -26 -90 -37 -20 -65 -44 -35 -54 -33 -73 -40 -2 -20 -75 -62 -39 -49 -74 -200 -108 -32 -98 -23 -16 -30 -52 -75 -51 -62 -34 -125 -60 -54 -34 -107 -42 -78 -16 -41 -22 -45 -32 -67 -11 -37 -22 -94 -58 -72 -18 -27 -22 -6 -25 -71 -14 -51 -10 -21 -10 -45 -41 -33 -13 -19 -25 -17 -45 -79 -17 -63 -6 -51 -34 -15 -21 -10 -34 -34 -43 -84 -50 -39 -5 -43 -31 -69 -4 -46 -25 -133 -0 -55 -0 -62 -15 -53 -41 -30 -104 -28 -73 -110 -58 -117 -107 -44 -100 -51 -49 -36 -63 -38 -61 -64 -40 -87 -51 -36 -84 -35 -39 -23 -59 -13 -53 -28 -47 -138 -71 -20 -39 -29 -44 -26 -52 -22 -90 -54 -78 -64 -67 -32 -27 -37 -53 -21 -70 -4 -61 -20 -51 -115 -73 -16 -46 -31 -43 -37 -51 -44 -55 -76 -27 -83 -24 -33 -137 -49 +215 66 -19 -23 -45 -117 -86 -115 -12 -157 -86 -91 -61 -31 -8 -30 -41 -120 -58 -86 -138 -117 -143 -88 -57 -29 -19 -47 -22 -40 -67 -22 -47 -75 -111 -64 -48 21 -17 -28 -19 -44 -85 -68 -69 -73 -42 -71 -47 -35 -10 -39 -6 -48 -62 -44 -88 -101 -48 -58 -51 -33 -31 -33 -41 -79 -0 -54 -141 -0 -90 -93 -54 -95 -28 -37 -40 -48 -68 -172 -109 -111 -61 -38 -21 -70 -19 -28 -34 -11 -70 -46 -56 -70 -49 -60 -0 -53 -45 -5 -13 -38 -41 -69 -157 -61 -77 -24 -17 -69 -63 -0 -10 -47 -28 -39 -195 -23 -44 -36 -7 -71 -59 -0 -9 -54 -38 -48 -200 -0 -17 -22 -13 -63 -34 -30 -13 -47 -0 -10 -91 -80 -83 -45 -22 -39 -87 -19 -42 -73 -180 -61 -91 -132 -29 -51 -97 -67 -69 -17 -38 -50 -93 -31 -67 -67 -88 -22 -60 -43 -45 32 -17 +4 +39 +31 +26 +18 +37 +64 +75 +215 +66 21 -95 +32 +4 +39 +31 +26 +18 +37 +64 +75 +215 +66 +21 +32 +4 +39 +31 +26 +18 +37 +64 +75 +215 +66 +21 +32 +4 +39 +31 +26 +18 +37 +64 +75 +215 +66 +21 +32 +4 +39 +31 +26 +18 +37 +64 +75 +215 +66 +21 +32 +4 +39 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +59 +36 +25 +49 +57 +111 +112 +54 +37 +71 +40 +32 +54 +35 +44 +35 +94 +124 +48 41 +107 +21 +58 +25 +54 +35 +44 +35 +94 +124 +48 +41 +107 +21 +58 +25 +54 +35 +44 +35 +94 +124 +48 +41 +107 +21 +58 +25 +54 +35 +44 +35 +94 +124 +48 +41 +107 +21 +58 +25 +54 +35 +44 +35 +94 +124 +48 +41 +107 +21 +58 +25 +54 +35 +44 +35 +94 +124 +48 +41 +107 +21 +58 +25 42 -76 -65 -46 -43 -22 -42 -24 -29 -13 -63 -68 -91 -67 -53 +23 +47 50 -52 +108 +77 +99 +90 +42 +32 +24 +51 +42 +23 +47 +50 +108 +77 +99 +90 +42 +32 +24 +51 +42 +23 +47 +50 +108 +77 +99 +90 +42 +32 +24 +51 +42 +23 +47 +50 +108 +77 +99 +90 +42 +32 +24 +51 +42 +23 +47 +50 +108 +77 +99 +90 +42 +32 +24 +51 +42 +23 +47 +50 +108 +77 +99 +90 +42 +32 +24 +51 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +59 +16 +42 +30 +78 +33 +60 +17 +65 +37 +70 +29 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 +31 +72 +32 +50 +53 +62 +120 +68 +32 +119 +53 +53 19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +19 +36 +46 +76 +59 +85 +104 +73 +127 +92 +57 +56 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +28 +22 +28 +35 +48 +73 +107 +54 +47 +52 +17 +62 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 +48 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 +48 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 +48 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 +48 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 +48 +54 +22 +37 +31 +107 +42 +60 +77 +67 +39 +43 48 29 -10 -22 -50 -78 -68 -86 -43 -46 -50 -24 -58 -17 -47 -21 -148 -0 -69 -52 -36 -35 -21 -43 -22 -97 -13 -9 -133 -155 -53 -104 -76 -130 -25 -30 -3 -60 -10 -7 -85 -158 -124 -81 -77 -114 -17 -22 -40 -49 -37 -4 -72 -99 -13 -136 -53 -88 -10 -28 -45 -55 -41 -0 -44 -163 -23 -90 -49 -57 -15 -37 -33 -52 -39 -4 -63 -107 -56 -64 -42 -74 -6 -34 -38 -44 -45 -11 -34 -167 -81 62 -57 -88 -24 -49 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36 +29 +62 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36 +29 +62 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36 +29 +62 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36 +29 +62 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36 +29 +62 +27 +9 +92 +138 +73 +85 +58 +96 +23 +36