예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
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
예제 #4
0
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
예제 #5
0
 def test_set_actual(self):
     actual = select_mungedata_simple(2, 1, '2015-1-1', '2015-1-10')
     self.im.set_actual(actual.waittime)
     self.assertEqual(actual.ix[24].waittime, self.im.actual.ix[24])
예제 #6
0
 def test_set_actual(self):
     actual = select_mungedata_simple(2, 1, '2015-1-1', '2015-1-10')
     self.im.set_actual(actual.waittime)
     self.assertEqual(actual.ix[24].waittime, self.im.actual.ix[24])