@@ -97,23 +97,27 @@ def __init__(self,
97
97
98
98
99
99
def shift_dates (self ):
100
- """shift estimates one day forward to account for a 1 day lag, e.g.
101
- we want to produce estimates for the time range May 2 to May 20, inclusive
102
- given a drop on May 20, we have data up until May 19.
103
- we then train on data from Jan 1 until May 19, storing only the sensors
104
- on May 1 to May 19. we then shift the dates forward by 1, giving us sensors
105
- on May 2 to May 20. therefore, we will move the startdate back by one day
106
- in order to get the proper estimate at May 1
100
+ """shift estimates forward to account for time lag, compute burnindates, sensordates
107
101
"""
108
- ## JS: WILL USE DATETIMEINDEX FOR THIS...
102
+
109
103
drange = lambda s , e : pd .date_range (start = s ,periods = (e - s ).days ,freq = 'D' )
110
104
self .startdate = self .startdate - Config .DAY_SHIFT
111
105
self .burnindate = self .startdate - Config .BURN_IN_PERIOD
112
106
self .fit_dates = drange (Config .FIRST_DATA_DATE , self .dropdate )
113
107
self .burn_in_dates = drange (self .burnindate , self .dropdate )
114
108
self .sensor_dates = drange (self .startdate , self .enddate )
109
+ return True
115
110
116
111
def geo_reindex (self ,data ,staticpath ):
112
+ """Reindex based on geography, include all date, geo pairs
113
+
114
+ Args:
115
+ data: dataframe, the output of loadcombineddata
116
+ staticpath: path for the static geographic files
117
+
118
+ Returns:
119
+ dataframe
120
+ """
117
121
# get right geography
118
122
geo = self .geo
119
123
geo_map = GeoMaps (staticpath )
@@ -207,7 +211,6 @@ def update_sensor(self,
207
211
pool_results = [proc .get () for proc in pool_results ]
208
212
209
213
for res in pool_results :
210
- ## un-tested
211
214
geo_id = res ["geo_id" ]
212
215
res = pd .DataFrame (res )
213
216
sensor_rates [geo_id ] = np .array (res .loc [final_sensor_idxs , "rate" ])
0 commit comments