示例#1
0
param = {
    'colsample_bytree': 0.8,
    'subsample': 0.1,
    'learning_rate': 0.1,
    'metric': 'auc',
    'max_depth': 4,
    'objective': 'binary',
    'nthread': 64,
    'seed': SEED
}

gc.collect()
yhat, imp, ret = ex.stacking(X,
                             y,
                             param,
                             NROUND,
                             nfold=5,
                             esr=50,
                             categorical_feature=categorical_feature)

t = datetime.today()
date = t.date()
hour = t.hour
imp.to_csv('imp_{}-{:02d}h.csv'.format(date, hour), index=False)

# =============================================================================
# cv
# =============================================================================

#model = xgb.train(param, dbuild, NROUND, watchlist, verbose_eval=10,
#                  early_stopping_rounds=50)
示例#2
0
    'max_bin': 100,
    'colsample_bytree': 0.5,
    'subsample': 0.5,
    'nthread': 64,
    'bagging_freq': 1,
    'seed': SEED
}

categorical_feature = [
    'NAME_CONTRACT_TYPE', 'CODE_GENDER', 'FLAG_OWN_CAR', 'FLAG_OWN_REALTY',
    'NAME_TYPE_SUITE', 'NAME_INCOME_TYPE', 'NAME_EDUCATION_TYPE',
    'NAME_FAMILY_STATUS', 'NAME_HOUSING_TYPE', 'OCCUPATION_TYPE',
    'WEEKDAY_APPR_PROCESS_START', 'ORGANIZATION_TYPE', 'FONDKAPREMONT_MODE',
    'HOUSETYPE_MODE', 'WALLSMATERIAL_MODE', 'EMERGENCYSTATE_MODE'
]

dtrain = lgb.Dataset(X, y, categorical_feature=categorical_feature)

yhat, imp, ret = ex.stacking(X,
                             y,
                             param,
                             9999,
                             esr=50,
                             seed=SEED,
                             categorical_feature=categorical_feature)

imp.to_csv(f'LOG/imp_{__file__}.csv', index=False)

#==============================================================================
utils.end(__file__)