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() z_prev = z.copy()
for month in range(12): METHOD = "mean"
model = model_per_month[month] if METHOD == "linear_regression":
u = entries_of_fully_known_stations[:, known_years:, month].T for month in range(12):
p = model.predict(u) model = model_per_month[month]
p[p<0] = 0 u = entries_of_fully_known_stations[:, known_years:, month].T
assert np.all(z[missing_stations, known_years:, month] == -1) p = model.predict(u)
z[missing_stations, known_years:, month] = p.T 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) assert np.all(z != -1)
df = pd.read_csv('test-A/in.tsv', header=None, sep='\t') df = pd.read_csv('test-A/in.tsv', header=None, sep='\t')
df.columns = in_columns df.columns = in_columns

File diff suppressed because it is too large Load Diff