def setUp(self): self.df = select_mungedata(2, 1, '2013-1-1', '2015-1-1') self.xtest = select_features('2015-1-1', '2015-1-10') self.actuals = select_mungedata_simple(2, 1, '2015-1-1', '2015-1-10') self.daily_avg = self.df.waittime.resample('D', how='mean') model = RandomForestRegressor(n_jobs=-1, n_estimators=2, random_state=1) self.im = IncrementalModel(self.df, model, categoricals=['event']) self.im.predict(self.xtest)
def run_Incremental(model, munger_id, xing, train_start, train_end, test_start, test_end): df_train = select_mungedata(munger_id, xing, train_start, train_end) X_test = select_features(test_start, test_end) actual = select_mungedata_simple(munger_id, xing, test_start, test_end) grid = GridSearchCV(model, {}) im = IncrementalModel(df_train, grid, categoricals=['event']) im.set_actual(actual.waittime) im.predict(X_test) return im