s434749
This commit is contained in:
parent
858c7511df
commit
2df663db76
12
run.py
12
run.py
@ -104,13 +104,21 @@ for month in range(12):
|
|||||||
|
|
||||||
z_prev = z.copy()
|
z_prev = z.copy()
|
||||||
|
|
||||||
for month in range(12):
|
METHOD = "mean"
|
||||||
|
if METHOD == "linear_regression":
|
||||||
|
for month in range(12):
|
||||||
model = model_per_month[month]
|
model = model_per_month[month]
|
||||||
u = entries_of_fully_known_stations[:, known_years:, month].T
|
u = entries_of_fully_known_stations[:, known_years:, month].T
|
||||||
p = model.predict(u)
|
p = model.predict(u)
|
||||||
p[p<0] = 0
|
p[p < 0] = 0
|
||||||
assert np.all(z[missing_stations, known_years:, month] == -1)
|
assert np.all(z[missing_stations, known_years:, month] == -1)
|
||||||
z[missing_stations, known_years:, month] = p.T
|
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
|
||||||
|
1412
test-A/out.tsv
1412
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user