Commit 383a93c5 authored by Dr.李's avatar Dr.李

when short of data

parent 7c52dee8
...@@ -292,10 +292,10 @@ def fetch_train_phase(engine, ...@@ -292,10 +292,10 @@ def fetch_train_phase(engine,
if dates[-1] == dt.datetime.strptime(ref_date, '%Y-%m-%d'): if dates[-1] == dt.datetime.strptime(ref_date, '%Y-%m-%d'):
end = dates[-2] end = dates[-2]
start = dates[-batch - 1] start = dates[-batch - 1] if batch <= len(dates) - 1 else dates[0]
else: else:
end = dates[-1] end = dates[-1]
start = dates[-batch] start = dates[-batch] if batch <= len(dates) else dates[0]
index = (date_label >= start) & (date_label <= end) index = (date_label >= start) & (date_label <= end)
this_raw_x = x_values[index] this_raw_x = x_values[index]
...@@ -370,7 +370,7 @@ def fetch_predict_phase(engine, ...@@ -370,7 +370,7 @@ def fetch_predict_phase(engine,
if dates[-1] == dt.datetime.strptime(ref_date, '%Y-%m-%d'): if dates[-1] == dt.datetime.strptime(ref_date, '%Y-%m-%d'):
end = dates[-1] end = dates[-1]
start = dates[-batch] start = dates[-batch] if batch <= len(dates) else dates[0]
left_index = bisect.bisect_left(date_label, start) left_index = bisect.bisect_left(date_label, start)
right_index = bisect.bisect_right(date_label, end) right_index = bisect.bisect_right(date_label, end)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment