This commit is contained in:
Alagris 2022-05-16 13:17:12 +02:00
parent 858c7511df
commit 2df663db76
2 changed files with 721 additions and 713 deletions

22
run.py
View File

@ -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

File diff suppressed because it is too large Load Diff