Exemple #1
0
def run(train_df, test_df):
    encoder = None
    encoder = Encoder(train_df)
    lr = modelDict["GBM"](need_scale=False)
    encoder.transform(train_df)
    n_train_df = pd.get_dummies(train_df)
    lr.train(n_train_df)
    encoder.transform(test_df)
    n_test_df = pd.get_dummies(test_df)
    y = lr.test(n_test_df)
    save(test_df, y, encoder)
Exemple #2
0
def run_ensemble(train_df):
    encoder = None
    encoder = Encoder(train_df)
    encoder.transform(train_df)
    estimators = []
    scores = []
    labels = []
    nums = list(range(1, 5, 1)) + list(range(5, 60, 5)) + list(
        range(60, 100, 10)) + list(range(100, 500, 50))
    for n in nums:
        lr = modelDict["GBM"](n_estimators=n)
        n_train_df = pd.get_dummies(train_df)
        train_score, val_score = lr.train(n_train_df)
        scores += [train_score, val_score]
        estimators += [n, n]
        labels += ['train', 'val']
    return scores, labels, estimators